@@ -666,14 +666,16 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
666
666
val expectedOuter = expectedTp.normalizedPrefix match {
667
667
// case ThisType(clazz) => This(clazz)
668
668
// case NoType => Literal(Constant(true)) // fallback for SI-6183 todo?
669
- case pre => ref(pre.typeSymbol )
669
+ case pre => ref(pre.termSymbol )
670
670
}
671
671
672
672
// ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` by `Select(q, outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix`
673
673
// if there's an outer accessor, otherwise the condition becomes `true` -- TODO: can we improve needsOuterTest so there's always an outerAccessor?
674
674
// val outer = expectedTp.typeSymbol.newMethod(vpmName.outer, newFlags = SYNTHETIC | ARTIFACT) setInfo expectedTp.prefix
675
675
676
- codegen._asInstanceOf(testedBinder, expectedTp).select(" <outer>" .toTermName).select(ctx.definitions.Object_eq ).appliedTo(expectedOuter)
676
+ val expectedClass = expectedTp.dealias.classSymbol.asClass
677
+ ExplicitOuter .ensureOuterAccessors(expectedClass)
678
+ codegen._asInstanceOf(testedBinder, expectedTp).select(ExplicitOuter .outerAccessor(expectedClass)).select(ctx.definitions.Object_eq ).appliedTo(expectedOuter)
677
679
}
678
680
}
679
681
@@ -750,11 +752,12 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
750
752
751
753
override lazy val localSubstitution : Substitution = EmptySubstitution
752
754
753
- lazy val outerTestNeeded = (
754
- (expectedTp.normalizedPrefix.typeSymbol ne NoSymbol )
755
- && ! expectedTp.normalizedPrefix.typeSymbol.isPackageObject
756
- && false && needsOuterTest(expectedTp, testedBinder.info, matchOwner)
757
- )
755
+ def outerTestNeeded = {
756
+ val np = expectedTp.normalizedPrefix
757
+ val ts = np.termSymbol
758
+ (ts ne NoSymbol ) && needsOuterTest(expectedTp, testedBinder.info, matchOwner)
759
+
760
+ }
758
761
759
762
// the logic to generate the run-time test that follows from the fact that
760
763
// a `prevBinder` is expected to have type `expectedTp`
0 commit comments