@@ -128,21 +128,23 @@ class Mixin extends MiniPhase with SymTransformer { thisPhase =>
128128 override def changesMembers : Boolean = true // the phase adds implementions of mixin accessors
129129
130130 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) {
132134 val sym1 =
133135 if (sym.is(Lazy )) sym
134136 else sym.copySymDenotation(initFlags = sym.flags &~ (ParamAccessor | Inline ) | Deferred )
135137 sym1.ensureNotPrivate
136138 }
137- else if sym.isAllOf(ModuleClass | Private ) && sym.owner.is( Trait ) then
139+ else if sym.isAllOf(ModuleClass | Private ) && ownerIsTrait then
138140 // modules in trait will be instantiated in the classes mixing in the trait; they must be made non-private
139141 // do not use ensureNotPrivate because the `name` must not be expanded in this case
140142 sym.copySymDenotation(initFlags = sym.flags &~ Private )
141- else if (sym.isConstructor && sym.owner.is( Trait ) )
143+ else if (sym.isConstructor && ownerIsTrait )
142144 sym.copySymDenotation(
143145 name = nme.TRAIT_CONSTRUCTOR ,
144146 info = MethodType (Nil , sym.info.resultType))
145- else if sym.is(Trait ) then
147+ else if sym.is(Trait , butNot = JavaDefined ) then
146148 val classInfo = sym.asClass.classInfo
147149 val decls1 = classInfo.decls.cloneScope
148150 var modified : Boolean = false
0 commit comments