Skip to content

Commit 5aaa406

Browse files
committed
Add test case.
We are still lacking the setup to do this right for mixed Scala 2/Dotty runtime tests. So I checked into `pos` for now.
1 parent 9e56405 commit 5aaa406

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This is supposed to be compiled by Dotty
2+
class Sub extends T
3+
4+
class A extends S2T with S2Tprivate {
5+
val a: Int = 3
6+
var b = 2
7+
}
8+
9+
object Main {
10+
def main(args: Array[String]): Unit = {
11+
val sub = new Sub
12+
println(sub.d)
13+
println(sub.v)
14+
println(sub.O)
15+
println(sub.w)
16+
17+
val a = new A
18+
a.x += a.y
19+
println(a.x)
20+
println(a.f(a.a + a.b))
21+
22+
a.xx += a.yy
23+
println(a.x)
24+
println(a.ff(a.xx))
25+
}
26+
}
27+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// This is supposed to be compiled by Scala 2.11
2+
trait T {
3+
def d = 42
4+
val v = ""
5+
object O
6+
final val w = 33
7+
}
8+
9+
trait S2T {
10+
var x: Int = 0
11+
lazy val y: Int = 1
12+
// val z: Int = 2
13+
val a: Int
14+
var b: Int
15+
16+
def f(x: Int): Int = x + y
17+
}
18+
19+
trait S2Tprivate {
20+
private var x: Int = 0
21+
private lazy val y: Int = 1
22+
// private val z: Int = 2 // @darkdimius uncomment once lazy vals can be inherited.
23+
24+
private def f(x: Int): Int = x + y
25+
def xx = x
26+
def xx_=(x: Int) = this.x = x
27+
def yy = y
28+
// def zz = z
29+
def ff(x: Int) = f(x)
30+
}
31+

0 commit comments

Comments
 (0)