Fable icon indicating copy to clipboard operation
Fable copied to clipboard

Explicit base constructor call not properly called

Open ncave opened this issue 4 years ago • 0 comments

type Node =
    val X: int
    new (x: int) = { X = x }

type Leaf =
    inherit Node
    val Y: string
    new (x: int, y: string) =
        { inherit Node(x); Y = y }

[<EntryPoint>]
let main _args =
    let node = Leaf(3, "4")
    let x = node.X  // <-- Error: This should be 3, but is undefined.
    let y = node.Y
    System.Console.WriteLine($"x: {x}, y: {y}")
    0

ncave avatar Apr 02 '21 18:04 ncave