Skip to content

Primary constructor of types from signature files (.fsi) are mangled #571

@ncave

Description

@ncave

Given the following project:

//--- test.fsi ---
module M
type Test =
    new : bool -> Test      // <-- here is what's causing it
    member Status: bool
//--- test.fs ---
module M
type Test(flag:bool) =
    member x.Status = flag
//--- project.fsx ---
#load "test.fsi"
#load "test.fs"

[<EntryPoint>]
let main argv =
    let t = M.Test(true)
    printfn "Status: %A" t.Status
    0

Here the constructor call will be generated as:
const t = _test.Test[".ctor"](true);

which causes a runtime error. It should be:
const t = new _test.Test(true);

The runtime error does not happen if the constructor definition is not used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions