diff options
Diffstat (limited to 'test/files/run/exceptions-2.scala')
-rw-r--r-- | test/files/run/exceptions-2.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala index bc374a1c49..7391789937 100644 --- a/test/files/run/exceptions-2.scala +++ b/test/files/run/exceptions-2.scala @@ -151,6 +151,32 @@ object Test { } catch { case _ => () } }; + def returnInBody: Unit = try { + try { + Console.println("Normal execution..."); + return + Console.println("non reachable code"); + } finally { + Console.println("inner finally"); + } + } finally { + Console.println("Outer finally"); + } + + def returnInBodySynch: Unit = try { + synchronized { + try { + Console.println("Synchronized normal execution..."); + return + Console.println("non reachable code"); + } finally { + Console.println("inner finally"); + } + } + } finally { + Console.println("Outer finally"); + } + def execute(f: => Unit) = try { f; @@ -196,5 +222,11 @@ object Test { Console.println("NoExcep.method4:"); execute(NoExcep.method4); + + Console.println("Return inside body:"); + execute(returnInBody); + + Console.println("Return inside synchronized body:"); + execute(returnInBodySynch); } } |