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.