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