File tree 4 files changed +22
-2
lines changed
compiler/src/dotty/tools/dotc/transform
4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -155,8 +155,9 @@ class SuperAccessors(thisPhase: DenotTransformer) {
155
155
156
156
val needAccessor =
157
157
name.isTermName // Types don't need super accessors
158
- && ! sym.isInlineMethod && ( // Inline methods can't be overridden, don't need superaccessors
159
- clazz != currentClass || ! validCurrentClass || mix.name.isEmpty && clazz.is(Trait ))
158
+ && ! sym.isEffectivelyErased // Erased and concrete inline methods are not called at runtime
159
+ && ! sym.isInlineMethod // so they don't need superaccessors.
160
+ && (clazz != currentClass || ! validCurrentClass || mix.name.isEmpty && clazz.is(Trait ))
160
161
161
162
if (needAccessor) atPhase(thisPhase.next)(superAccessorCall(sel, mix.name))
162
163
else sel
Original file line number Diff line number Diff line change
1
+
2
+ import language .experimental .erasedDefinitions
3
+ trait A :
4
+ erased def g = 1
5
+ trait B extends A :
6
+ erased def f = super .g
7
+ class C extends B
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ class C extends B
7
7
@ main def Test =
8
8
val c = C ()
9
9
assert(c.f == 1 )
10
+
Original file line number Diff line number Diff line change
1
+ trait T :
2
+ def g = 2
3
+ trait A extends T :
4
+ inline override def g = 1
5
+ trait B extends A :
6
+ def f = super .g
7
+ class C extends B
8
+
9
+ @ main def Test =
10
+ val c = C ()
11
+ assert(c.f == 1 )
You can’t perform that action at this time.
0 commit comments