summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/exceptions-2.check8
-rw-r--r--test/files/run/exceptions-2.scala32
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);
}
}