Forráskód Böngészése

don't choke on recusive BOOB constraints

closes #11870
Simon Krajewski 10 hónapja
szülő
commit
5c65f03675

+ 1 - 1
src/typing/typeload.ml

@@ -766,7 +766,7 @@ and type_type_params ctx host path p tpl =
 					| TInst (c2,_) when ttp.ttp_class == c2 ->
 						raise_typing_error "Recursive constraint parameter is not allowed" p
 					| TInst ({ cl_kind = KTypeParameter ttp },_) ->
-						List.iter loop (get_constraints ttp)
+						delay ctx.g PConnectField (fun () -> List.iter loop (get_constraints ttp))
 					| _ ->
 						()
 				in

+ 2 - 0
tests/misc/projects/Issue11870/Main.hx

@@ -0,0 +1,2 @@
+function copyValue<B:O, O:B>() {}
+function main() {}

+ 1 - 0
tests/misc/projects/Issue11870/compile-fail.hxml

@@ -0,0 +1 @@
+--run Main

+ 1 - 0
tests/misc/projects/Issue11870/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:1: characters 1-34 : Recursive constraint parameter is not allowed