Browse Source

do not generate invalid TInst argument to unify_call_params (closes #2648)

Simon Krajewski 11 years ago
parent
commit
60021955ad
2 changed files with 19 additions and 1 deletions
  1. 18 0
      tests/unit/issues/Issue2648.hx
  2. 1 1
      typer.ml

+ 18 - 0
tests/unit/issues/Issue2648.hx

@@ -0,0 +1,18 @@
+package unit.issues;
+import unit.Test;
+
+#if java
+private class Test<T> {
+	@:overload static public function forName(s:Int) { }
+	@:overload static public function forName(s:String) { }
+}
+#end
+
+class Issue2648 extends Test {
+	#if java
+	function test() {
+		Test.forName(1);
+		Test.forName("s");
+	}
+	#end
+}

+ 1 - 1
typer.ml

@@ -3307,7 +3307,7 @@ and type_call ctx e el (with_type:with_type) p =
 and build_call ctx acc el (with_type:with_type) p =
 	let fopts t f = match follow t with
 		| (TInst (c,pl) as t) -> Some (t,f)
-		| (TAnon a) as t -> (match !(a.a_status) with Statics c -> Some (TInst(c,[]),f) | _ -> Some (t,f))
+		| (TAnon a) as t -> (match !(a.a_status) with Statics c -> Some (TInst(c,List.map snd c.cl_types),f) | _ -> Some (t,f))
 		| _ -> None
 	in
 	let push_this e =