Browse Source

[typer] push @:publicFields to abstract implementation classes

closes #10541
Simon Krajewski 3 years ago
parent
commit
4976732be3
2 changed files with 15 additions and 1 deletions
  1. 1 1
      src/typing/typeloadModule.ml
  2. 14 0
      tests/unit/src/unit/issues/Issue10541.hx

+ 1 - 1
src/typing/typeloadModule.ml

@@ -350,7 +350,7 @@ let module_pass_1 ctx m tdecls loadp =
 				(match !decls with
 				(match !decls with
 				| (TClassDecl c,_) :: _ ->
 				| (TClassDecl c,_) :: _ ->
 					List.iter (fun m -> match m with
 					List.iter (fun m -> match m with
-						| ((Meta.Using | Meta.Build | Meta.CoreApi | Meta.Allow | Meta.Access | Meta.Enum | Meta.Dce | Meta.Native | Meta.HlNative | Meta.JsRequire | Meta.PythonImport | Meta.Expose | Meta.Deprecated | Meta.PhpGlobal),_,_) ->
+						| ((Meta.Using | Meta.Build | Meta.CoreApi | Meta.Allow | Meta.Access | Meta.Enum | Meta.Dce | Meta.Native | Meta.HlNative | Meta.JsRequire | Meta.PythonImport | Meta.Expose | Meta.Deprecated | Meta.PhpGlobal | Meta.PublicFields),_,_) ->
 							c.cl_meta <- m :: c.cl_meta;
 							c.cl_meta <- m :: c.cl_meta;
 						| _ ->
 						| _ ->
 							()
 							()

+ 14 - 0
tests/unit/src/unit/issues/Issue10541.hx

@@ -0,0 +1,14 @@
+package unit.issues;
+
+@:publicFields
+private abstract Foo(Int) from Int {
+	static function make(f:Float) {
+		return Std.int(f);
+	}
+}
+
+class Issue10541 extends Test {
+	function test() {
+		eq(1, Foo.make(1.2));
+	}
+}