File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1745,7 +1745,7 @@ class Typer extends Namer
17451745 .withSpan(expr.span)
17461746 val caps =
17471747 for
1748- CaseDef (pat, _ , _) <- cases
1748+ case CaseDef (pat, EmptyTree , _) <- cases
17491749 if Feature .enabled(Feature .saferExceptions) && pat.tpe.widen.isCheckedException
17501750 yield makeCanThrow(pat.tpe.widen)
17511751 caps.foldLeft(expr)((e, g) => untpd.Block (g :: Nil , e))
Original file line number Diff line number Diff line change 1+ import annotation .experimental
2+ import language .experimental .saferExceptions
3+
4+ @ experimental
5+ case class Ex (i : Int ) extends Exception (s " Exception: $i" )
6+
7+ @ experimental
8+ def foo (): Unit throws Ex = throw Ex (1 )
9+
10+ @ experimental
11+ object Main :
12+ def main (args : Array [String ]): Unit =
13+ try
14+ foo() // error
15+ catch
16+ case _ : Ex if false => println(" Caught" )
You can’t perform that action at this time.
0 commit comments