summaryrefslogtreecommitdiff
path: root/test/files/pos/presuperContext.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2013-02-01 14:31:32 +0100
committerLukas Rytz <lukas.rytz@epfl.ch>2013-02-03 21:08:34 +0100
commitf3cdf146709e0dd98533ee77e8ca2566380cb932 (patch)
tree54333250b47e1a744cb0b2454ea955bd9586b4c9 /test/files/pos/presuperContext.scala
parent7e836f83e2930755f5d6b896a140909eb686289d (diff)
downloadscala-f3cdf146709e0dd98533ee77e8ca2566380cb932.tar.gz
scala-f3cdf146709e0dd98533ee77e8ca2566380cb932.tar.bz2
scala-f3cdf146709e0dd98533ee77e8ca2566380cb932.zip
Fix context for type checking early initializers
Before: scala> class A { class C extends { val x: A = this } with AnyRef } <console>:7: error: type mismatch; found : A.this.C required: A class A { class C extends { val x: A = this } with AnyRef } ^ Note that the same thing is necessary and already done in Namers (see def createNamer). The whole logic of when and how to create contexts should be factored out and reused in Namer and Typer. ( My Hobby [1]: detecting compiler by just looking at its soruce [1] http://www.explainxkcd.com/wiki/index.php?title=Category:My_Hobby )
Diffstat (limited to 'test/files/pos/presuperContext.scala')
-rw-r--r--test/files/pos/presuperContext.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/files/pos/presuperContext.scala b/test/files/pos/presuperContext.scala
new file mode 100644
index 0000000000..cc34263073
--- /dev/null
+++ b/test/files/pos/presuperContext.scala
@@ -0,0 +1,13 @@
+class A {
+ class C extends { val x: A = this } with AnyRef
+}
+
+class B(x: Int)
+
+class D {
+ class C(x: Int) extends B({val test: D = this; x}) {
+ def this() {
+ this({val test: D = this; 1})
+ }
+ }
+}