You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeIInterface=abstractmemberLOL :intlettypeMatchSomeBoxedObject(o:obj)=match o with|:? int ->1|:? IInterface ->2|_->3letd=(typeMatchSomeBoxedObject "lol")
printfn "%A" d
Expected: A type that does not implement the interface does not match the second match case and therefore 3 is returned via wildcard match case. This is what happens when executing the F# code
Actual: 2 is returned, as the wildcard match case is not generated
Related information
Fable version: 4.24.0
The text was updated successfully, but these errors were encountered:
but Fable JavaScript generates a warning when type checking against an interface to inform the user.
Going back to the Python target, looking at the code I suppose we should be able to type check against IInterface because the interface does generate an actual Python type.
Looking online, I see that we could use isinstance or type to do that. What should be used here? My supposition is isinstace because it will also check subclasses.
Description
It seems like, when typematching against an interface, incorrect match result code is generated.
Repro code
See REPL
or transpile this code:
the resulting python code:
Expected and actual results
Expected: A type that does not implement the interface does not match the second match case and therefore 3 is returned via wildcard match case. This is what happens when executing the F# code
Actual: 2 is returned, as the wildcard match case is not generated
Related information
The text was updated successfully, but these errors were encountered: