From ce2affc166c29d34616bcfef53c8aaa9a95749a9 Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Mon, 25 Sep 2006 15:37:45 +0000 Subject: Fixed bug regarding 'return's inside try-finall... Fixed bug regarding 'return's inside try-finally blocks --- test/files/run/exceptions-2.check | 8 ++++++++ test/files/run/exceptions-2.scala | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'test/files/run') 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); } } -- cgit v1.2.3