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
I randomly found this problem today in the test for #2685:
functionmain() {
vara:Int=func1(1);
$type(func1); // (a : Dynamic) -> Intvars:String=func1("foo"); // Int should be String
}
functionfunc1(a:Dynamic) {
returna;
}
The problem is that the return type of func1 remains a monomorph because those are not bound to Dynamic. It is instead unified with the type of var a:Int and thus the function itself ends up as (a : Dynamic) -> Int, which is just wrong.
Very related to #3033 and I still maintain that functions should not expose their monomorphs. I'll try to see what happens if we bind leftover monomorphs to Dynamic (and maybe Void for some return types?), but I expect some friction here.
The text was updated successfully, but these errors were encountered:
I randomly found this problem today in the test for #2685:
The problem is that the return type of
func1
remains a monomorph because those are not bound toDynamic
. It is instead unified with the type ofvar a:Int
and thus the function itself ends up as(a : Dynamic) -> Int
, which is just wrong.Very related to #3033 and I still maintain that functions should not expose their monomorphs. I'll try to see what happens if we bind leftover monomorphs to
Dynamic
(and maybeVoid
for some return types?), but I expect some friction here.The text was updated successfully, but these errors were encountered: