Browse Source

[typer] apply interface parameters on implicit abstract fields

closes #10748
Simon Krajewski 3 years ago
parent
commit
949f069b2e
2 changed files with 22 additions and 1 deletions
  1. 1 1
      src/typing/typeloadCheck.ml
  2. 21 0
      tests/unit/src/unit/issues/Issue10748.hx

+ 1 - 1
src/typing/typeloadCheck.ml

@@ -356,7 +356,7 @@ module Inheritance = struct
 			let t = (apply_params intf.cl_params params f.cf_type) in
 			let is_overload = ref false in
 			let make_implicit_field () =
-				let cf = {f with cf_overloads = []} in
+				let cf = {f with cf_overloads = []; cf_type = apply_params intf.cl_params params f.cf_type} in
 				begin try
 					let cf' = PMap.find cf.cf_name c.cl_fields in
 					ctx.com.overload_cache#remove (c.cl_path,f.cf_name);

+ 21 - 0
tests/unit/src/unit/issues/Issue10748.hx

@@ -0,0 +1,21 @@
+package unit.issues;
+
+private interface I<T> {
+	function foo(v:T):Void;
+}
+
+private abstract class Base implements I<Int> {
+	public function new() {}
+}
+
+private class Real extends Base {
+	public function foo(v:Int) {}
+}
+
+class Issue10748 extends Test {
+	function test() {
+		var r = new Real();
+		r.foo(33);
+		utest.Assert.pass();
+	}
+}