File tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/typer 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1751,7 +1751,7 @@ class Typer extends Namer
1751
1751
.withSpan(expr.span)
1752
1752
val caps =
1753
1753
for
1754
- CaseDef (pat, _ , _) <- cases
1754
+ case CaseDef (pat, EmptyTree , _) <- cases
1755
1755
if Feature .enabled(Feature .saferExceptions) && pat.tpe.widen.isCheckedException
1756
1756
yield makeCanThrow(pat.tpe.widen)
1757
1757
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