diff --git a/tests/unit/src/unit/issues/Issue4557.hx b/tests/unit/src/unit/issues/Issue4557.hx new file mode 100644 index 00000000000..be9f67e6d1a --- /dev/null +++ b/tests/unit/src/unit/issues/Issue4557.hx @@ -0,0 +1,25 @@ +package unit.issues; + +private class Ghost { + public var value:String; + public function new(value) { + this.value = value; + } +} + +private class A { + public var ghost = new Ghost("booh!"); +} + +private class B extends A { } + +private class C extends B { + public function new() { } +} + +class Issue4557 extends Test { + function test() { + var c = new C(); + eq("booh!", c.ghost.value); + } +} \ No newline at end of file diff --git a/typeload.ml b/typeload.ml index eb15361215b..ff27f970c27 100644 --- a/typeload.ml +++ b/typeload.ml @@ -1270,11 +1270,11 @@ let check_strict_meta ctx metas = let rec add_constructor ctx c force_constructor p = match c.cl_constructor, c.cl_super with - | None, Some ({ cl_constructor = Some cfsup } as csup,cparams) when not c.cl_extern && not (Meta.has Meta.CompilerGenerated cfsup.cf_meta) -> + | None, Some ({ cl_constructor = Some cfsup } as csup,cparams) when not c.cl_extern -> let cf = { cfsup with cf_pos = p; - cf_meta = []; + cf_meta = List.filter (fun (m,_,_) -> m = Meta.CompilerGenerated) cfsup.cf_meta; cf_doc = None; cf_expr = None; } in