2
0
Эх сурвалжийг харах

don't bind but do_bind

closes #12050
Simon Krajewski 5 сар өмнө
parent
commit
7ba8e17cfb

+ 1 - 1
src/typing/matcher/exprToPattern.ml

@@ -33,7 +33,7 @@ let unapply_type_parameters params monos =
 		match t2,follow t2 with
 		| TMono m1,TMono m2 ->
 			unapplied := (m1,m1.tm_type) :: !unapplied;
-			Monomorph.bind m1 tp1.ttp_type;
+			Monomorph.do_bind m1 tp1.ttp_type;
 		| _ -> ()
 	) params monos;
 	!unapplied

+ 12 - 0
tests/misc/projects/Issue12050/Main.hx

@@ -0,0 +1,12 @@
+function main() {}
+
+function toString<T>(status:BroadcastStatus<T>)
+	return switch status {
+		case NotAvailable: 'NotAvailable';
+	}
+
+interface MediaDevice {}
+
+enum BroadcastStatus<T:MediaDevice> {
+	NotAvailable;
+}

+ 2 - 0
tests/misc/projects/Issue12050/compile-fail.hxml

@@ -0,0 +1,2 @@
+--main Main
+--interp

+ 2 - 0
tests/misc/projects/Issue12050/compile-fail.hxml.stderr

@@ -0,0 +1,2 @@
+Main.hx:3: characters 45-46 : Constraint check failure for BroadcastStatus.T
+Main.hx:3: characters 45-46 : ... toString.T should be MediaDevice