closes #12241
@@ -107,7 +107,13 @@ let valid_redefinition map1 map2 f1 t1 f2 t2 = (* child, parent *)
| ct1,ct2 ->
List.iter (fun t2 ->
let t2 = map2 t2 in
- if not (List.exists (fun t1 -> does_unify (map1 t1) t2) ct1) then
+ if not (List.exists (fun t1 ->
+ try
+ Type.unify_custom uctx (map1 t1) t2;
+ true
+ with Unify_error _ ->
+ false
+ ) ct1) then
raise (Unify_error ([Unify_custom (Printf.sprintf "Constraint unsatisfied for type parameter %s: %s" ttp2.ttp_name (s_type (print_context()) t2))]))
) ct2
in
@@ -0,0 +1,21 @@
+package unit.issues;
+
+private interface I {
+ function f<T, C:Array<T>>(c:C):C;
+}
+private class C implements I {
+ public function new() {}
+ public function f<T, C:Array<T>>(c:C) {
+ return c;
+ }
+class Issue12241 extends Test {
+ function test() {
+ var c:I = new C();
+ var a = [];
+ eq(a, c.f(a));