diff options
Diffstat (limited to 'test/files/run/exceptions-2.scala')
-rw-r--r-- | test/files/run/exceptions-2.scala | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala index 2583542747..e006bc053d 100644 --- a/test/files/run/exceptions-2.scala +++ b/test/files/run/exceptions-2.scala @@ -1,7 +1,7 @@ /* * Try exception handling and finally blocks. * - * $Id: $ + * $Id$ */ @@ -124,6 +124,35 @@ object Test { Console.println(x); } + def tryFinallyTry: Unit = { + try { + () + } finally { + try { + error("a"); + } catch { + case _ => Console.println("Silently ignore exception in finally"); + } + } + } + + def valInFinally: Unit = + try { + } finally { + val fin = "Abc"; + Console.println(fin); + }; + + def tryAndValInFinally: Unit = + try { + } finally { + val fin = "Abc"; + try { + Console.println(fin); + } catch { case _ => () } + }; + + def execute(f: => Unit) = try { f; } catch { @@ -150,6 +179,14 @@ object Test { Console.println("method3:"); execute(method3); + Console.println("tryFinallyTry:"); + execute(tryFinallyTry); + + Console.println("valInFinally:"); + execute(valInFinally); + Console.println("tryAndValInFinally"); + execute(tryAndValInFinally); + Console.println("================="); Console.println("NoExcep.method2:"); |