-
Notifications
You must be signed in to change notification settings - Fork 316
Open
Labels
Description
Description
It's claimed in Fable 4.18.0 release notes that static interfaces are now supported however my code still fails to compile to JS.
Repro code
It's simplified version of #3822 I reported before (claimed to be fixed by 4.18.0 but it's actually not), you can try to run it in https://fable.io/repl/
type AbstractId<'ImplId when 'ImplId :> AbstractId<'ImplId>> =
static abstract member Parse: idStr: string -> 'ImplId
type MyId = MyId of int
with
interface AbstractId<MyId> with
static member Parse (idStr: string) =
System.Int32.Parse idStr |> MyId
let inline parse<'ImplId when 'ImplId :> AbstractId<'ImplId>> (idStr: string) : 'ImplId =
'ImplId.Parse idStr
printfn "Id constructed: %A" (MyId 1234)
printfn "Id parsed: %A" (parse<MyId> "1234")Expected and actual results
Expected
Code outputs
Id constructed: MyId 1234
Id parsed: MyId 1234
Just like it does in LINQPad, for example:
Actual
It fails to compile. Note that it passes F# compilation step but fails further translation to JS
Related information
If I comment out last line it compiles and runs fine:
- Fable version: 4.18.0
- OS: Windows 11


