summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-03-13 16:48:57 +0000
committerPaul Phillips <paulp@improving.org>2009-03-13 16:48:57 +0000
commita7ea09750252edb05465232db0ee2e4ed8ac4039 (patch)
tree3d46560182bbe932da980e9ae879c9d0af9ad2f8 /test
parent5f0edd35f0264789c3b5200f3cf7ec1b95335837 (diff)
downloadscala-a7ea09750252edb05465232db0ee2e4ed8ac4039.tar.gz
scala-a7ea09750252edb05465232db0ee2e4ed8ac4039.tar.bz2
scala-a7ea09750252edb05465232db0ee2e4ed8ac4039.zip
Modifies try/catch/finally to allow arbitrary e...
Modifies try/catch/finally to allow arbitrary expressions for try. Formerly { ... } was required for try. Now expressions like: val x = try Integer.parseInt("xx") catch { case e => 10 } work as one would hope.
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/tryexpr.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/files/pos/tryexpr.scala b/test/files/pos/tryexpr.scala
new file mode 100644
index 0000000000..c16428e7a5
--- /dev/null
+++ b/test/files/pos/tryexpr.scala
@@ -0,0 +1,10 @@
+// stretching more flexible try/catch's legs a bit
+object o {
+ try Integer.parseInt("xxxx") catch { case e => 5 }
+ try 5
+ try try try 10
+ try try try 10 catch { case e => 20 } finally 30
+ try try try 10 catch { case e => 20 } finally 30 finally 40
+ try try try 10 catch { case e => 20 } finally 30 finally 40 finally 50
+ try try try 10 finally 50
+} \ No newline at end of file