Skip to content

Commit 7b0d7d9

Browse files
committed
Add test file
1 parent 3f6a5f4 commit 7b0d7d9

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

tests/run/i1503.check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
hello
2+
hi
3+
33
4+
hi
5+
hi

tests/run/i1503.scala

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
object Test {
2+
3+
def test1() =
4+
(new Function0[Unit] {
5+
def apply() = println("hello")
6+
})()
7+
8+
val cond = true
9+
val foo = () => println("hi")
10+
val bar = () => println("there")
11+
12+
val baz = (x: Int) => println(x)
13+
14+
def test2() =
15+
(if (cond) foo else bar)()
16+
17+
def test2a() =
18+
(if (cond) baz else baz)(33)
19+
20+
def test3() =
21+
(try foo
22+
catch { case ex: Exception => bar }
23+
finally ())()
24+
25+
def test4() =
26+
(cond match {
27+
case true => foo
28+
case false => bar
29+
})()
30+
31+
def main(args: Array[String]) = {
32+
test1()
33+
test2()
34+
test2a()
35+
test3()
36+
test4()
37+
}
38+
}

0 commit comments

Comments
 (0)