aboutsummaryrefslogtreecommitdiff
path: root/tests/run/i1503.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/i1503.scala')
-rw-r--r--tests/run/i1503.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/run/i1503.scala b/tests/run/i1503.scala
new file mode 100644
index 000000000..56bb9af0c
--- /dev/null
+++ b/tests/run/i1503.scala
@@ -0,0 +1,38 @@
+object Test {
+
+ def test1() =
+ (new Function0[Unit] {
+ def apply() = println("hello")
+ })()
+
+ val cond = true
+ val foo = () => println("hi")
+ val bar = () => println("there")
+
+ val baz = (x: Int) => println(x)
+
+ def test2() =
+ (if (cond) foo else bar)()
+
+ def test2a() =
+ (if (cond) baz else baz)(33)
+
+ def test3() =
+ (try foo
+ catch { case ex: Exception => bar }
+ finally ())()
+
+ def test4() =
+ (cond match {
+ case true => foo
+ case false => bar
+ })()
+
+ def main(args: Array[String]) = {
+ test1()
+ test2()
+ test2a()
+ test3()
+ test4()
+ }
+}