Skip to content

Commit 383fd5c

Browse files
author
Adriaan Moors
committed
SI-6183 don't crash on type error in outer test
unfortunately without test case since the report was hard to minimize since it was a crash on erroneous code, I figured a backstop against a crash should suffice
1 parent 114367c commit 383fd5c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,9 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
10431043

10441044
def outerTest(testedBinder: Symbol, expectedTp: Type): Tree = {
10451045
val expectedOuter = expectedTp.prefix match {
1046-
case ThisType(clazz) => THIS(clazz)
1047-
case pre => REF(pre.prefix, pre.termSymbol)
1046+
case ThisType(clazz) => THIS(clazz)
1047+
case pre if pre != NoType => REF(pre.prefix, pre.termSymbol)
1048+
case _ => TRUE_typed // fallback for SI-6183
10481049
}
10491050

10501051
// ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` by `Select(q, outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix`

0 commit comments

Comments
 (0)