File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -217,11 +217,13 @@ object ExplicitOuter {
217217 cls.info.parents.exists(parent => // needs outer to potentially pass along to parent
218218 needsOuterIfReferenced(parent.classSymbol.asClass)))
219219
220- /** Class is always instantiated in the compilation unit where it is defined */
220+ /** Class is only instantiated in the compilation unit where it is defined */
221221 private def hasLocalInstantiation (cls : ClassSymbol )(using Context ): Boolean =
222222 // Modules are normally locally instantiated, except if they are declared in a trait,
223223 // in which case they will be instantiated in the classes that mix in the trait.
224- cls.owner.isTerm || cls.is(Private , butNot = Module ) || (cls.is(Module ) && ! cls.owner.is(Trait ))
224+ cls.ownersIterator.takeWhile(! _.isStatic).exists(_.isTerm)
225+ || cls.is(Private , butNot = Module )
226+ || cls.is(Module ) && ! cls.owner.is(Trait )
225227
226228 /** The outer parameter accessor of cass `cls` */
227229 private def outerParamAccessor (cls : ClassSymbol )(using Context ): TermSymbol =
Original file line number Diff line number Diff line change 1+ class C {
2+ def foo = {
3+ class D {
4+ class E
5+ }
6+ class F
7+ }
8+ }
You can’t perform that action at this time.
0 commit comments