summaryrefslogtreecommitdiff
path: root/test/files/run/t5543.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/t5543.scala')
-rw-r--r--test/files/run/t5543.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/run/t5543.scala b/test/files/run/t5543.scala
index 651bc7f2b2..3684bf9690 100644
--- a/test/files/run/t5543.scala
+++ b/test/files/run/t5543.scala
@@ -22,5 +22,24 @@ object Test extends Function0[Int] {
println(sut.toString)
println(sut.m())
println(A.init()())
+
+ println((new T.C()).x)
+ println((new T.D(0,0)).x)
+ }
+}
+
+object T {
+ override def toString = "T"
+
+ // `this` refers to T
+ class C(val x: Any = {println(this); this}) { // prints T
+ println(this) // prints C
+ override def toString() = "C"
+ }
+
+ class D(val x: Any) {
+ override def toString() = "D"
+ // `this` refers again to T
+ def this(a: Int, b: Int, c: Any = {println(this); this}) { this(c); println(this) } // prints T, then prints D
}
}