@@ -6202,7 +6202,12 @@ struct
in
if not (is_static || error) then match find_first_declared_field gen cl ~exact_field:{ cf with cf_type = actual_t } cf.cf_name with
| Some(_,actual_t,_,_,declared_cl,tl,tlch) ->
- if declared_cl != cl && overloads_cast_to_base then begin
+ let rec is_super e = match e.eexpr with
+ | TConst TSuper -> true
+ | TParenthesis p | TMeta(_,p) -> is_super p
+ | _ -> false
+ in
+ if declared_cl != cl && overloads_cast_to_base && not (is_super !ef) then begin
let pos = (!ef).epos in
ef := {
eexpr = TCall(
@@ -0,0 +1,34 @@
+package unit.issues;
+
+class Issue3575 extends Test {
+ function test() {
+ eq('ChildBase!',new Child().toString());
+ eq('ChildBase!',new Child() + '');
+ }
+}
+@:nativeGen private class Base
+{
+ public function getName()
+ {
+ return "Base!";
+class Child extends Base
+ public function new()
+ override public function getName()
+ return "Something Else";
+ public function toString()
+ return 'Child' + super.getName();