@@ -128,21 +128,23 @@ class Mixin extends MiniPhase with SymTransformer { thisPhase =>
128
128
override def changesMembers : Boolean = true // the phase adds implementions of mixin accessors
129
129
130
130
override def transformSym (sym : SymDenotation )(using Context ): SymDenotation =
131
- if (sym.is(Accessor , butNot = Deferred ) && sym.owner.is(Trait )) {
131
+ def ownerIsTrait : Boolean = wasOneOf(sym.owner, Trait )
132
+
133
+ if (sym.is(Accessor , butNot = Deferred ) && ownerIsTrait) {
132
134
val sym1 =
133
135
if (sym.is(Lazy )) sym
134
136
else sym.copySymDenotation(initFlags = sym.flags &~ (ParamAccessor | Inline ) | Deferred )
135
137
sym1.ensureNotPrivate
136
138
}
137
- else if sym.isAllOf(ModuleClass | Private ) && sym.owner.is( Trait ) then
139
+ else if sym.isAllOf(ModuleClass | Private ) && ownerIsTrait then
138
140
// modules in trait will be instantiated in the classes mixing in the trait; they must be made non-private
139
141
// do not use ensureNotPrivate because the `name` must not be expanded in this case
140
142
sym.copySymDenotation(initFlags = sym.flags &~ Private )
141
- else if (sym.isConstructor && sym.owner.is( Trait ) )
143
+ else if (sym.isConstructor && ownerIsTrait )
142
144
sym.copySymDenotation(
143
145
name = nme.TRAIT_CONSTRUCTOR ,
144
146
info = MethodType (Nil , sym.info.resultType))
145
- else if sym.is(Trait ) then
147
+ else if sym.is(Trait , butNot = JavaDefined ) then
146
148
val classInfo = sym.asClass.classInfo
147
149
val decls1 = classInfo.decls.cloneScope
148
150
var modified : Boolean = false
0 commit comments