Skip to content

Commit a7dd2c7

Browse files
committed
Try various combinations of toplevel definitions
1 parent a8349be commit a7dd2c7

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

tests/run/toplevel-mixed/A_1.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
val x: Int = 10
3+
4+
def x(s: String): Int = s.length
5+
6+
def y(s: String) = s.length
7+
8+
type X2 = String
9+
10+
type X3 = String

tests/run/toplevel-mixed/B_1.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
class x(val s: String)
3+
4+
object y {
5+
def foo = 3
6+
}
7+
8+
object X2 {
9+
def bar = "hi"
10+
}
11+
12+
class X3
13+

tests/run/toplevel-mixed/Test_2.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object Test extends App {
2+
assert(x == 10)
3+
assert(x("abc") == 3)
4+
assert((new x("abc")).s == "abc")
5+
6+
assert(y("abc") == 3)
7+
assert(y.foo == 3)
8+
9+
val x2: X2 = "abc"
10+
assert(X2.bar == "hi")
11+
12+
val x3: X3 = new X3
13+
}

0 commit comments

Comments
 (0)