File tree 1 file changed +3
-3
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -213,9 +213,9 @@ object ExplicitOuter {
213
213
214
214
/** Class is always instantiated in the compilation unit where it is defined */
215
215
private def hasLocalInstantiation (cls : ClassSymbol )(implicit ctx : Context ): Boolean =
216
- // scala2x modules always take an outer pointer(as of 2.11)
217
- // dotty modules are always locally instantiated
218
- cls.owner.isTerm || cls.is(Private ) || cls.is(Module , butNot = Scala2x )
216
+ // Modules are normally locally instantiated, except if they are declared in a trait,
217
+ // in which case they will be instantiated in the classes that mix in the trait.
218
+ cls.owner.isTerm || cls.is(Private , butNot = Module ) || ( cls.is(Module ) && ! cls.owner.is( Trait ) )
219
219
220
220
/** The outer parameter accessor of cass `cls` */
221
221
private def outerParamAccessor (cls : ClassSymbol )(implicit ctx : Context ): TermSymbol =
You can’t perform that action at this time.
0 commit comments