aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/i1401.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-21 14:51:16 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-21 17:42:53 +0200
commitc37185d3307e2b02e25e888fd44d5e8bba95aa1d (patch)
treeb0ec5f8198a559abb1cf83f68a8bed3ad318a4a4 /tests/pos/i1401.scala
parenteaffc785be1e42c3a44ce149dfb8cabb6681d7c6 (diff)
downloaddotty-c37185d3307e2b02e25e888fd44d5e8bba95aa1d.tar.gz
dotty-c37185d3307e2b02e25e888fd44d5e8bba95aa1d.tar.bz2
dotty-c37185d3307e2b02e25e888fd44d5e8bba95aa1d.zip
Fix #1401: Make sure all refs are forwarded
Faced with recursive dependencies through self types, we might have to apply `normalizeToClassRefs` to a class P with a parent that is not yet initialized (witnessed by P's parents being Nil). In that case we should still execute forwardRefs on P, but we have to wait in a suspension until P is initialized. This avoids the problem raised in #1401. I am still not quite sure why forwardRefs is needed, but it seems that asSeenFrom alone is not enough to track the dependencies in this case.
Diffstat (limited to 'tests/pos/i1401.scala')
-rw-r--r--tests/pos/i1401.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/pos/i1401.scala b/tests/pos/i1401.scala
new file mode 100644
index 000000000..140d78e7f
--- /dev/null
+++ b/tests/pos/i1401.scala
@@ -0,0 +1,25 @@
+package i1401
+
+trait Subtractable[A, +Repr <: Subtractable[A, Repr]] {
+ def -(elem: A): Repr
+}
+
+trait BufferLike[BA, +This <: BufferLike[BA, This] with Buffer[BA]]
+ extends Subtractable[BA, This]
+{ self : This =>
+
+ /* Without fix-#1401:
+ *
+ error: overriding method - in trait Subtractable of type (elem: A)This & i1401.Buffer[A];
+ method - of type (elem: BA)This has incompatible type
+ def -(elem: BA): This
+ ^
+ one error found
+ */
+ def -(elem: BA): This
+}
+
+trait Buffer[A] extends BufferLike[A, Buffer[A]]
+
+
+