summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-28 14:36:42 -0700
committerPaul Phillips <paulp@improving.org>2012-10-09 14:17:34 -0700
commitba36c44c31d1a1e0b5c0cf3d4775edd0ae0d5a13 (patch)
tree8eb8caeb82afa0677a2e78291a990a9e525f3c7e /test
parent432f9368011e0fd9e89ca0e18082bfec180baf32 (diff)
downloadscala-ba36c44c31d1a1e0b5c0cf3d4775edd0ae0d5a13.tar.gz
scala-ba36c44c31d1a1e0b5c0cf3d4775edd0ae0d5a13.tar.bz2
scala-ba36c44c31d1a1e0b5c0cf3d4775edd0ae0d5a13.zip
Fix for SI-4744, another variety of cycle.
I threw this in with the previous commit behind -Ybreak-cycles, but this one is much less sketchy. Explanation: have to handle f-bounds more deftly. Namers forces lower bounds to prevent recursion in that direction, but a light touch is required to handle these two situations differently: // This is a cyclic type parameter - an error is correct class A[T <: Comparable[_ <: T]] // This is not cyclic - it flips the arrow class B[T <: Comparable[_ >: T]] Long have I been haunted by the knowledge that you can write class B in java, but not in scala: public class B<T extends Comparable<? super T>> {} It's over! We've achieved parity with java.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/cycle-bounds.check4
-rw-r--r--test/files/neg/cycle-bounds.flags1
-rw-r--r--test/files/neg/cycle-bounds.scala5
-rw-r--r--test/files/neg/t1224.check2
-rw-r--r--test/files/neg/t1224.flags1
-rw-r--r--test/files/pos/cycle-bounds.scala1
-rw-r--r--test/files/pos/t4744.flags1
-rw-r--r--test/files/pos/t4744/Bar.scala (renamed from test/pending/pos/t4744/Bar.scala)0
-rw-r--r--test/files/pos/t4744/Foo.java (renamed from test/pending/pos/t4744/Foo.java)0
9 files changed, 13 insertions, 2 deletions
diff --git a/test/files/neg/cycle-bounds.check b/test/files/neg/cycle-bounds.check
new file mode 100644
index 0000000000..d924838aec
--- /dev/null
+++ b/test/files/neg/cycle-bounds.check
@@ -0,0 +1,4 @@
+cycle-bounds.scala:5: error: illegal cyclic reference involving type T
+class NotOk[T <: Comparable[_ <: T]]
+ ^
+one error found
diff --git a/test/files/neg/cycle-bounds.flags b/test/files/neg/cycle-bounds.flags
new file mode 100644
index 0000000000..ca20f55172
--- /dev/null
+++ b/test/files/neg/cycle-bounds.flags
@@ -0,0 +1 @@
+-Ybreak-cycles
diff --git a/test/files/neg/cycle-bounds.scala b/test/files/neg/cycle-bounds.scala
new file mode 100644
index 0000000000..0b43bc703e
--- /dev/null
+++ b/test/files/neg/cycle-bounds.scala
@@ -0,0 +1,5 @@
+// This should be allowed
+class Ok[T <: Comparable[_ >: T]]
+
+// This is (il)legitimately a cyclic reference
+class NotOk[T <: Comparable[_ <: T]]
diff --git a/test/files/neg/t1224.check b/test/files/neg/t1224.check
index fb61275911..ab8a6f1130 100644
--- a/test/files/neg/t1224.check
+++ b/test/files/neg/t1224.check
@@ -1,4 +1,4 @@
-t1224.scala:4: error: illegal cyclic reference involving type T
+t1224.scala:4: error: lower bound C[A.this.T] does not conform to upper bound C[C[A.this.T]]
type T >: C[T] <: C[C[T]]
^
one error found
diff --git a/test/files/neg/t1224.flags b/test/files/neg/t1224.flags
new file mode 100644
index 0000000000..ca20f55172
--- /dev/null
+++ b/test/files/neg/t1224.flags
@@ -0,0 +1 @@
+-Ybreak-cycles
diff --git a/test/files/pos/cycle-bounds.scala b/test/files/pos/cycle-bounds.scala
deleted file mode 100644
index 0aa7aa552b..0000000000
--- a/test/files/pos/cycle-bounds.scala
+++ /dev/null
@@ -1 +0,0 @@
-class Foo[T <: Comparable[_ >: T]]
diff --git a/test/files/pos/t4744.flags b/test/files/pos/t4744.flags
new file mode 100644
index 0000000000..ca20f55172
--- /dev/null
+++ b/test/files/pos/t4744.flags
@@ -0,0 +1 @@
+-Ybreak-cycles
diff --git a/test/pending/pos/t4744/Bar.scala b/test/files/pos/t4744/Bar.scala
index 1fb6d78973..1fb6d78973 100644
--- a/test/pending/pos/t4744/Bar.scala
+++ b/test/files/pos/t4744/Bar.scala
diff --git a/test/pending/pos/t4744/Foo.java b/test/files/pos/t4744/Foo.java
index 6c764d0470..6c764d0470 100644
--- a/test/pending/pos/t4744/Foo.java
+++ b/test/files/pos/t4744/Foo.java