Skip to content

Commit 6c276dc

Browse files
committed
1 parent 7e61b23 commit 6c276dc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tests/run/traits-initialization.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
object store {
2+
var str = ""
3+
}
4+
5+
import store._
6+
17
trait A {
2-
var str = ""
3-
str = "a"
8+
str += "a"
49
val s = str += 'A'
510
str += '1'
611
}
@@ -11,15 +16,16 @@ trait B extends A {
1116
str += '2'
1217
}
1318

14-
class D(sup: =>String) extends A {
19+
class D(sup: Unit) extends A {
1520
str += 'd'
1621
override val s = str += 'D'
1722
str += '3'
1823
}
1924

20-
object Test extends D({Test.str += "Z"; Test.str}) with B {
25+
26+
object Test extends D({str += "Z"}) with B {
2127
// should only have 2 fields
2228
str += 'E'
23-
def main(args: Array[String]) = assert(str == "aA1dD3bB2E4", str)
29+
def main(args: Array[String]) = assert(str == "ZaA1dD3bB2E4", str)
2430
str += '4'
2531
}

0 commit comments

Comments
 (0)