@@ -331,6 +331,10 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
331331 case Typed (pat @ UnApply (_, _, _), _) => project(pat)
332332 case Typed (expr, tpt) =>
333333 Typ (erase(expr.tpe.stripAnnots), true )
334+ case This (_) =>
335+ Typ (pat.tpe.stripAnnots, false )
336+ case EmptyTree => // default rethrow clause of try/catch, check tests/patmat/try2.scala
337+ Typ (WildcardType , false )
334338 case _ =>
335339 debug.println(s " unknown pattern: $pat" )
336340 Empty
@@ -917,13 +921,15 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
917921 else Empty
918922 }.reduce((a, b) => Or (List (a, b)))
919923
920- val curr = project(cases(i).pat)
924+ if (cases(i).pat != EmptyTree ) { // rethrow case of catch
925+ val curr = project(cases(i).pat)
921926
922- debug.println(s " ---------------reachable? ${show(curr)}" )
923- debug.println(s " prev: ${show(prevs)}" )
927+ debug.println(s " ---------------reachable? ${show(curr)}" )
928+ debug.println(s " prev: ${show(prevs)}" )
924929
925- if (isSubspace(intersect(curr, Typ (selTyp, false )), prevs)) {
926- ctx.warning(MatchCaseUnreachable (), cases(i).body.pos)
930+ if (isSubspace(intersect(curr, Typ (selTyp, false )), prevs)) {
931+ ctx.warning(MatchCaseUnreachable (), cases(i).body.pos)
932+ }
927933 }
928934 }
929935 }
0 commit comments