File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import core.Decorators._
1313import core .StdNames .nme
1414import core .Names ._
1515import core .NameOps ._
16+ import core .NameKinds .SuperArgName
1617import SymUtils ._
1718import dotty .tools .dotc .ast .tpd
1819
@@ -197,10 +198,16 @@ object ExplicitOuter {
197198 private def outerAccName (cls : ClassSymbol )(using Context ): TermName =
198199 nme.OUTER .expandedName(cls)
199200
201+ private def outerOwner (sym : Symbol )(using Context ): Symbol =
202+ val owner = sym.effectiveOwner
203+ if owner.name.is(SuperArgName ) || owner.isLocalDummy
204+ then owner.enclosingClass
205+ else owner
206+
200207 /** Class needs an outer pointer, provided there is a reference to an outer this in it. */
201208 def needsOuterIfReferenced (cls : ClassSymbol )(using Context ): Boolean =
202209 ! (cls.isStatic
203- || cls.effectiveOwner .isStaticOwner
210+ || outerOwner( cls) .isStaticOwner
204211 || cls.is(PureInterface )
205212 )
206213
Original file line number Diff line number Diff line change 11class C1 (x : AnyRef ) {};
22
33class C2 extends C1 ({ class A extends AnyRef {}; (new A ) : AnyRef }) {};
4+
5+ class Outer :
6+ class C2 extends C1 ({ class A extends AnyRef {}; (new A ) : AnyRef }) {};
You can’t perform that action at this time.
0 commit comments