@@ -660,7 +660,9 @@ let build_instance ctx mtype p =
let r = exc_protect ctx (fun r ->
let t = mk_mono() in
r := (fun() -> t);
- unify_raise ctx (f()) t p;
+ let tf = (f()) in
+ unify_raise ctx tf t p;
+ link_dynamic t tf;
t
) s in
delay ctx PForce (fun() -> ignore ((!r)()));
@@ -0,0 +1,11 @@
+package unit.issues;
+
+@:genericBuild(unit.issues.misc.Issue4666Macro.getType())
+private class C { }
+class Issue4666 extends Test {
+ public function test() {
+ var c:C;
+ unit.TestType.typedAs(c, (null:Dynamic));
+ }
+}
@@ -0,0 +1,7 @@
+package unit.issues.misc;
+class Issue4666Macro {
+ static public function getType() {
+ return macro : Dynamic;
@@ -1235,6 +1235,11 @@ let rec link e a b =
true
end
+let link_dynamic a b = match follow a,follow b with
+ | TMono r,TDynamic _ -> r := Some b
+ | TDynamic _,TMono r -> r := Some a
+ | _ -> ()
let rec fast_eq a b =
if a == b then