소스 검색

[typer] allow `from Dynamic` to work properly

closes #8425
Simon Krajewski 6 년 전
부모
커밋
a43862dc15
2개의 변경된 파일15개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/core/type.ml
  2. 14 0
      tests/unit/src/unit/issues/Issue8425.hx

+ 1 - 1
src/core/type.ml

@@ -2288,7 +2288,7 @@ and unify_from ab tl a b ?(allow_transitive_cast=true) t =
 		(fun (a2,b2) -> fast_eq a a2 && fast_eq b b2)
 		(fun() ->
 			let t = apply_params ab.a_params tl t in
-			let unify_func = if allow_transitive_cast then unify else type_eq EqStrict in
+			let unify_func = if allow_transitive_cast then unify else type_eq EqRightDynamic in
 			unify_func a t)
 
 and unify_to ab tl b ?(allow_transitive_cast=true) t =

+ 14 - 0
tests/unit/src/unit/issues/Issue8425.hx

@@ -0,0 +1,14 @@
+package unit.issues;
+
+import utest.Assert;
+
+private abstract A(Dynamic) from Dynamic {}
+private abstract B(String) {}
+
+
+class Issue8425 extends unit.Test {
+	function test() {
+		var a:A = (null : B);
+		Assert.pass();
+	}
+}