File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments