diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2007-01-29 16:06:54 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2007-01-29 16:06:54 +0000 |
commit | 2937f4ebca48d5614b5e1a2ae0aa3dac298010a8 (patch) | |
tree | 8b9cb09ac488fac85e952db255a01f2f10076fd1 /test/files/run/exceptions-2.scala | |
parent | ebdcd61b654a27eb355e79ccf6795b7b205fd660 (diff) | |
download | scala-2937f4ebca48d5614b5e1a2ae0aa3dac298010a8.tar.gz scala-2937f4ebca48d5614b5e1a2ae0aa3dac298010a8.tar.bz2 scala-2937f4ebca48d5614b5e1a2ae0aa3dac298010a8.zip |
Fixed the bugfix for returns inside finally
Diffstat (limited to 'test/files/run/exceptions-2.scala')
-rw-r--r-- | test/files/run/exceptions-2.scala | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala index 7391789937..e9a7eea963 100644 --- a/test/files/run/exceptions-2.scala +++ b/test/files/run/exceptions-2.scala @@ -178,6 +178,41 @@ object Test { } + def returnInBodyAndInFinally: Unit = try { + try { + Console.println("Normal execution..."); + return + Console.println("non reachable code"); + } finally { + Console.println("inner finally"); + return + } + } finally { + Console.println("Outer finally"); + return + } + + def returnInBodyAndInFinally2: Unit = try { + try { + Console.println("Normal execution..."); + return + Console.println("non reachable code"); + } finally { + try { + Console.println("inner finally"); + return + } finally { + Console.println("finally inside finally"); + } + } + } finally { + Console.println("Outer finally"); + return + } + + + + def execute(f: => Unit) = try { f; } catch { @@ -228,5 +263,11 @@ object Test { Console.println("Return inside synchronized body:"); execute(returnInBodySynch); + + Console.println("Return inside body and return in finally:"); + execute(returnInBodyAndInFinally); + + Console.println("Return inside body and return in finally inside finally:"); + execute(returnInBodyAndInFinally2); } } |