Browse Source

[typer] fix CTIntersection check

closes #8869
Simon Krajewski 3 years ago
parent
commit
46c855f068
2 changed files with 7 additions and 3 deletions
  1. 3 1
      src/typing/typeload.ml
  2. 4 2
      tests/unit/src/unit/issues/Issue8869.hx

+ 3 - 1
src/typing/typeload.ml

@@ -794,10 +794,12 @@ let rec type_type_param ?(enum_constructor=false) ctx path get_params p tp =
 		let r = exc_protect ctx (fun r ->
 			r := lazy_processing (fun() -> t);
 			let ctx = { ctx with type_params = ctx.type_params @ get_params() } in
-			let constr = match fst th with
+			let rec loop th = match fst th with
 				| CTIntersection tl -> List.map (load_complex_type ctx true) tl
+				| CTParent ct -> loop ct
 				| _ -> [load_complex_type ctx true th]
 			in
+			let constr = loop th in
 			(* check against direct recursion *)
 			let rec loop t =
 				match follow t with

+ 4 - 2
tests/unit/src/unit/issues/Issue8869.hx

@@ -5,9 +5,11 @@ class Issue8869 extends Test {
 		noAssert();
 	}
 
-	function checkIntersectionConstraintInParentheses<T:(haxe.Constraints.Constructible<()->Void> & Dummy)>(cl:Class<T>) {}
+	function checkIntersectionConstraintInParentheses<T:(haxe.Constraints.Constructible<() -> Void> & Dummy)>(cl:Class<T>) {}
+
+	function checkFunctionTypeConstraint<T:(Int) -> Void>() {}
 }
 
 private class Dummy {
 	public function new() {}
-}
+}