diff options
Diffstat (limited to 'test/files/run/exceptions-nest.scala')
-rw-r--r-- | test/files/run/exceptions-nest.scala | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test/files/run/exceptions-nest.scala b/test/files/run/exceptions-nest.scala index 841e6b1c67..432d600d13 100644 --- a/test/files/run/exceptions-nest.scala +++ b/test/files/run/exceptions-nest.scala @@ -5,9 +5,9 @@ object Test extends App { println(test3) println(test4) println(test5) - try { println(test6) } catch { case _ => println("OK") } + try { println(test6) } catch { case _: Throwable => println("OK") } println(test7) - try { println(test8) } catch { case _ => println("OK") } + try { println(test8) } catch { case _: Throwable => println("OK") } println(test9) println(test10) println(test11) @@ -19,7 +19,7 @@ object Test extends App { x = 2 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -31,12 +31,12 @@ object Test extends App { try { x = 21 } catch { - case _ => x = 22 + case _: Throwable => x = 22 } x = 23 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -44,10 +44,10 @@ object Test extends App { def test3 = { var x = 1 try { - try{x = 2} catch { case _ => x = 4 } + try{x = 2} catch { case _: Throwable => x = 4 } } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -58,7 +58,7 @@ object Test extends App { x = 2 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } try { x = 5 @@ -73,8 +73,8 @@ object Test extends App { try { x = 2 } catch { - case _: NullPointerException => try { x = 3 } catch { case f => throw f } - case _ => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43 + case _: NullPointerException => try { x = 3 } catch { case f: Throwable => throw f } + case _: Throwable => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43 } x } @@ -87,7 +87,7 @@ object Test extends App { } catch { case e: NullPointerException => throw e - case _ => + case _: Throwable => x = 3 return 1000 } finally { @@ -105,7 +105,7 @@ object Test extends App { try { x = 4 } catch { - case _ => x = 5 + case _: Throwable => x = 5 } } x @@ -116,7 +116,7 @@ object Test extends App { try { throw new NullPointerException } catch { - case e => throw e + case e: Throwable => throw e } x } @@ -124,7 +124,7 @@ object Test extends App { def test9 = { try { "" match { case s: String => 10 - }} catch { case _ => 20 } + }} catch { case _: Throwable => 20 } } var x10 = 1 @@ -135,7 +135,7 @@ object Test extends App { def test11 { try { () } - catch { case e => () } + catch { case e: Throwable => () } } class E1 extends Exception |