aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/t0054.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-12 17:02:47 +0100
committerMartin Odersky <odersky@gmail.com>2014-03-12 17:05:13 +0100
commit66291018e0512b2d4e7d6bac017ab47b95939275 (patch)
tree3ea52f67edcf42c860207ec806d38959654f4f57 /tests/pos/t0054.scala
parent7fa78597bf58a7759303095121a432cb258f447c (diff)
downloaddotty-66291018e0512b2d4e7d6bac017ab47b95939275.tar.gz
dotty-66291018e0512b2d4e7d6bac017ab47b95939275.tar.bz2
dotty-66291018e0512b2d4e7d6bac017ab47b95939275.zip
Fix constructor completion problem detected in t0054
Constructors need to be completed in the context which immediately encloses a class. Otherwise type references in the constructor see the wrong types, as is demonstrated in t0054. The difficulty here is that the inner class B nested in A also extends from A. Then it makes a difference whether the constructor parameter types of B are resolved in the context of B or in the context of A. Added explanation for context handling of constructors.
Diffstat (limited to 'tests/pos/t0054.scala')
-rw-r--r--tests/pos/t0054.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/pos/t0054.scala b/tests/pos/t0054.scala
new file mode 100644
index 000000000..670160f36
--- /dev/null
+++ b/tests/pos/t0054.scala
@@ -0,0 +1,4 @@
+class A {
+ case class B(x: C) extends A { val z: A.this.C = x }
+ class C {}
+}