aboutsummaryrefslogtreecommitdiff
path: root/tests/pending
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-11-21 14:45:01 +0100
committerMartin Odersky <odersky@gmail.com>2014-11-24 14:57:49 +0100
commit7427c671f9a5321dd13a74b5175bba512699b385 (patch)
tree037dbd3394a259592edc6a9bc264b09ddb31b01c /tests/pending
parenta89f48d1c3bef21ecf14048985334de6e0a8e505 (diff)
downloaddotty-7427c671f9a5321dd13a74b5175bba512699b385.tar.gz
dotty-7427c671f9a5321dd13a74b5175bba512699b385.tar.bz2
dotty-7427c671f9a5321dd13a74b5175bba512699b385.zip
Fixes in TypeComparer for RefinedTypes.
The previous scheme did not propagate bounds correctly. More generally, given a comparison T { X <: A } <: U { X <: B } it would errenously decompose this to T <: U, A <: B But we really need to check whether the total constraint for X in T { X <: A } subsumes the total constraint for X in T { X <: B } The new scheme propagates only if the binding in the lower type is an alias. E.g. T { X = A } <: Y { X <: B } decomposes to T { A = A } <: U, A <: B The change uncovered another bug, where in the slow path we too a member relative to a refined type; We need to "narrow" the type to a RefinedThis instead. (See use of "narrow" in TypeComparer). That change uncovered a third bug concerning the underlying type of a RefinedThis. The last bug was fixed in a previous commit (84f32cd814f2e07725b6ad1f6bff23d4ee38c397). Two tests (1048, 1843) which were pos tests for scalac but failed compling in dotc have changed their status and location. They typecheck now, but fail later. They have been moved to pending. There's a lot of diagnostic code in TypeComparer to figure out the various problems. I left it in to be able to come back to the commit in case there are more problems. The checks and diagnostics will be removed in a subsequent commit.
Diffstat (limited to 'tests/pending')
-rw-r--r--tests/pending/pos/t1048.scala14
-rw-r--r--tests/pending/pos/t1843.scala24
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/pending/pos/t1048.scala b/tests/pending/pos/t1048.scala
new file mode 100644
index 000000000..b8694b38e
--- /dev/null
+++ b/tests/pending/pos/t1048.scala
@@ -0,0 +1,14 @@
+trait T[U] {
+ def x: T[_ <: U]
+}
+
+object T {
+ def unapply[U](t: T[U]): Option[T[_ <: U]] = Some(t.x)
+}
+
+object Test {
+ def f[W](t: T[W]) = t match {
+ case T(T(_)) => ()
+ }
+}
+
diff --git a/tests/pending/pos/t1843.scala b/tests/pending/pos/t1843.scala
new file mode 100644
index 000000000..871b21346
--- /dev/null
+++ b/tests/pending/pos/t1843.scala
@@ -0,0 +1,24 @@
+/**
+* Scala Compiler Will Crash On this File
+* ... Or Will It?
+*
+*/
+object Crash {
+ trait UpdateType[A]
+ case class StateUpdate[A](updateType : UpdateType[A], value : A)
+ case object IntegerUpdateType extends UpdateType[Integer]
+
+ //However this method will cause a crash
+ def crash(updates: List[StateUpdate[_]]): Unit = {
+ updates match {
+ case Nil =>
+ case u::us =>
+ u match {
+ //Line below seems to be the crashing line
+ case StateUpdate(key, newValue) if (key == IntegerUpdateType) =>
+ println("Requires a statement to induce the crash")
+ case _ =>
+ }
+ }
+ }
+}