Skip to content

Commit 0a9c61c

Browse files
oderskyDarkDimius
authored andcommitted
Fixed needs outer test
1 parent 2f63059 commit 0a9c61c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ object ExplicitOuter {
137137
nme.OUTER.expandedName(cls)
138138

139139
/** Class needs an outer pointer, provided there is a reference to an outer this in it. */
140-
private def needsOuterIfReferenced(cls: ClassSymbol)(implicit ctx: Context): Boolean = !(
140+
def needsOuterIfReferenced(cls: ClassSymbol)(implicit ctx: Context): Boolean = !(
141141
cls.isStatic ||
142142
cls.owner.enclosingClass.isStaticOwner ||
143143
cls.is(Interface)

src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,9 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
740740
// See the test for SI-7214 for motivation for dealias. Later `treeCondStrategy#outerTest`
741741
// generates an outer test based on `patType.prefix` with automatically dealises.
742742
patType.dealias match {
743-
case TypeRef(pre, name) =>
744-
(pre ne NoType)// && isPopulated(copyTypeRef(patType, pre1, sym, args), selType)
743+
case tref @ TypeRef(pre, name) =>
744+
(pre ne NoPrefix) && tref.symbol.isClass &&
745+
ExplicitOuter.needsOuterIfReferenced(tref.symbol.asClass)
745746
case _ =>
746747
false
747748
}

0 commit comments

Comments
 (0)