We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d19c30c commit da773fbCopy full SHA for da773fb
tests/run/traitParams.scala
@@ -1,19 +1,26 @@
1
+object State {
2
+ var s: Int = 0
3
+}
4
+
5
trait T(x: Int, val y: Int) {
6
def f = x
7
}
8
9
trait U extends T {
10
+ State.s += 1
11
override def f = super.f + y
12
13
+import State._
14
+class C(x: Int) extends U with T(x, x * x + s)
15
+class C2(x: Int) extends T(x, x * x + s) with U
16
-class C(x: Int) extends U with T(x, x * x)
-
-class D extends C(10) with T {
-}
17
+class D extends C(10) with T
18
+class D2 extends C2(10) with T
19
20
object Test {
- def main(args: Array[String]): Unit =
21
+ def main(args: Array[String]): Unit = {
22
assert(new D().f == 110)
23
+ assert(new D2().f == 111)
24
+ }
25
26
0 commit comments