diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2006-09-25 15:37:45 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2006-09-25 15:37:45 +0000 |
commit | ce2affc166c29d34616bcfef53c8aaa9a95749a9 (patch) | |
tree | 2b678738782fa64ca7b00a519bd3586b3ddf6327 /test/files | |
parent | d12123f57d8dc08c6d55c7c11735b27b56b1182a (diff) | |
download | scala-ce2affc166c29d34616bcfef53c8aaa9a95749a9.tar.gz scala-ce2affc166c29d34616bcfef53c8aaa9a95749a9.tar.bz2 scala-ce2affc166c29d34616bcfef53c8aaa9a95749a9.zip |
Fixed bug regarding 'return's inside try-finall...
Fixed bug regarding 'return's inside try-finally blocks
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/exceptions-2.check | 8 | ||||
-rw-r--r-- | test/files/run/exceptions-2.scala | 32 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check index bb9c3dcd92..0cfb9a6a8c 100644 --- a/test/files/run/exceptions-2.check +++ b/test/files/run/exceptions-2.check @@ -28,3 +28,11 @@ NoExcep.method3: method3 NoExcep.method4: .. +Return inside body: +Normal execution... +inner finally +Outer finally +Return inside synchronized body: +Synchronized normal execution... +inner finally +Outer finally 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); } } |