summaryrefslogtreecommitdiff
path: root/test/files/run/t5543.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2013-01-29 13:46:56 +0100
committerLukas Rytz <lukas.rytz@epfl.ch>2013-02-03 21:08:34 +0100
commitb74c33eb860622e3630949ee0eeac9c15e8df166 (patch)
treec5f80cbe5d5a552bd1bb8efeb6f3b8b1499b0e2e /test/files/run/t5543.scala
parenta06d31f6a2df021acc18b10ad9cad0f80d7498f2 (diff)
downloadscala-b74c33eb860622e3630949ee0eeac9c15e8df166.tar.gz
scala-b74c33eb860622e3630949ee0eeac9c15e8df166.tar.bz2
scala-b74c33eb860622e3630949ee0eeac9c15e8df166.zip
SI-1803, plus documentation and cleanups in Namers, mainly in typeSig
- when typing (and naming) a ValDef, tpt and rhs are now type checked in the same context (the inner / ValDef context). this does not change any behavior, but is more uniform (same as for DefDef). martin told me (offline) that this change is desirable if it doesn't break anything. (it doesn't). - typeSig is now more uniform with a separate method for each case (methodSig, valDefSig, etc). methodSig was cleaned up (no more variables) and documented. the type returned by methodSig no longer contains / refers to type skolems, but to the actual type parameters (so we don't need to replace the skolems lateron). - documentation on constructor contexts, type skolems - more tests for SI-5543
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
}
}