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 | |
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')
-rw-r--r-- | test/files/run/exceptions-2.check | 9 | ||||
-rw-r--r-- | test/files/run/exceptions-2.scala | 41 |
2 files changed, 50 insertions, 0 deletions
diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check index 0cfb9a6a8c..95728fb058 100644 --- a/test/files/run/exceptions-2.check +++ b/test/files/run/exceptions-2.check @@ -36,3 +36,12 @@ Return inside synchronized body: Synchronized normal execution... inner finally Outer finally +Return inside body and return in finally: +Normal execution... +inner finally +Outer finally +Return inside body and return in finally inside finally: +Normal execution... +inner finally +finally inside finally +Outer finally 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); } } |