aboutsummaryrefslogtreecommitdiff
path: root/tests/invalid/pos/ticket2251.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-20 22:00:29 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-20 22:00:45 +0100
commite51b8845fb20fe3a4e1c655d4b72e2833906bbc2 (patch)
tree91bc16867d7a709566d8be80902b3256294cf338 /tests/invalid/pos/ticket2251.scala
parent581fee04f808d6f7759f98358e7475e6a58138e3 (diff)
downloaddotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.tar.gz
dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.tar.bz2
dotty-e51b8845fb20fe3a4e1c655d4b72e2833906bbc2.zip
The big pending/pos test triage
Diffstat (limited to 'tests/invalid/pos/ticket2251.scala')
-rw-r--r--tests/invalid/pos/ticket2251.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/invalid/pos/ticket2251.scala b/tests/invalid/pos/ticket2251.scala
new file mode 100644
index 000000000..006407247
--- /dev/null
+++ b/tests/invalid/pos/ticket2251.scala
@@ -0,0 +1,39 @@
+
+// Martin: I am not sure this is a solvable problem right now. I'll leave it in pending.
+// derived from pos/t1001
+class A
+trait B[T <: B[T]] extends A
+class C extends B[C]
+class D extends B[D]
+
+class Data {
+ // force computing lub of C and D (printLubs enabled:)
+
+/*
+lub of List(D, C) at depth 2
+ lub of List(D, C) at depth 1
+ lub of List(D, C) at depth 0
+ lub of List(D, C) is A
+ lub of List(D, C) is B[_1] forSome { type _1 >: D with C <: A }
+lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { type _1 >: D with C{} <: A } }
+*/
+// --> result = WRONG
+
+ // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation
+
+ val data: List[A] = List(new C, new D)
+
+ val data2 = List(new C, new D)
+
+ val data3: List[B[_ <: B[_ <: A]]] = List(new C, new D)
+
+ // Not yet --
+ // val data4: List[B[X] forSome { type X <: B[X] }] = List(new C, new D)
+ // <console>:7: error: type mismatch;
+ // found : List[B[_ >: D with C <: B[_ >: D with C <: A]]]
+ // required: List[B[X] forSome { type X <: B[X] }]
+ // val data4: List[B[X] forSome { type X <: B[X] }] = List(new C, new D)
+
+ // works
+ val data5 = List[B[X] forSome { type X <: B[X] }](new C, new D)
+}