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
This issue appeared recently, I suspect the fix for #906 to be causing it.
typeResult<'T>= Result<'T,string>letget():Result<int>= Ok 42lettest()=match get()with| Ok y -> string y
|_->"Error"
The above returns "Error"; without the Result<int> type annotation, it returns "42".
// Faulty output (with type alias annotation)HelloWorld.test=function(){HelloWorld.get();returnvoid0==0?Global.String(void0):"Error";};// Correct output (without type alias annotation)HelloWorld.test=function(){varm;m=HelloWorld.get();returnm.$==0?Global.String(m.$0):"Error";};
(Thanks @cata for reporting this on gitter and working together on a repro!)
The text was updated successfully, but these errors were encountered:
Also to note is that this only happens if the aliased type is a struct.
Tarmil
changed the title
Invalid output code when using a generic type alias
Invalid output code when using a generic type alias to a struct union
Feb 21, 2018
Issue was not all uses of looking at F# types resolved type aliases. For example accessing a struct union is wrapped in an AddressOf case by FCS, and the code ignoring this when it is a local variable was not resolving type aliases.
This issue appeared recently, I suspect the fix for #906 to be causing it.
The above returns "Error"; without the
Result<int>
type annotation, it returns "42".(Thanks @cata for reporting this on gitter and working together on a repro!)
The text was updated successfully, but these errors were encountered: