summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-06-19 13:52:31 +0000
committerMartin Odersky <odersky@gmail.com>2007-06-19 13:52:31 +0000
commit7b6fe636f87ec3e5643adb6d6fc36a800b8e2022 (patch)
tree32746f3bdaa00d0261f2fb67350b19dc6bf0e5e8
parent1edd1f1db181088b1cbbe7358190993b4ef82161 (diff)
downloadscala-7b6fe636f87ec3e5643adb6d6fc36a800b8e2022.tar.gz
scala-7b6fe636f87ec3e5643adb6d6fc36a800b8e2022.tar.bz2
scala-7b6fe636f87ec3e5643adb6d6fc36a800b8e2022.zip
changed test files: bug1001 compiles now.
-rw-r--r--test/files/neg/typeerror.check6
-rw-r--r--test/files/neg/typeerror.scala7
-rw-r--r--test/files/pos/bug1001.scala105
3 files changed, 118 insertions, 0 deletions
diff --git a/test/files/neg/typeerror.check b/test/files/neg/typeerror.check
new file mode 100644
index 0000000000..c087ba594b
--- /dev/null
+++ b/test/files/neg/typeerror.check
@@ -0,0 +1,6 @@
+typeerror.scala:6: error: type mismatch;
+ found : Long(in method add)
+ required: Long(in package scala)
+ else add2(x.head, y.head) :: add(x.tail, y.tail)
+ ^
+one error found
diff --git a/test/files/neg/typeerror.scala b/test/files/neg/typeerror.scala
new file mode 100644
index 0000000000..158ad17936
--- /dev/null
+++ b/test/files/neg/typeerror.scala
@@ -0,0 +1,7 @@
+object Test {
+ def add2(x:Long,y:Long): Long = x + y
+
+ def add[Long](x: List[Long], y: List[Long]): List[Long] =
+ if (x.isEmpty || y.isEmpty) Nil
+ else add2(x.head, y.head) :: add(x.tail, y.tail)
+}
diff --git a/test/files/pos/bug1001.scala b/test/files/pos/bug1001.scala
new file mode 100644
index 0000000000..1b909fb2ad
--- /dev/null
+++ b/test/files/pos/bug1001.scala
@@ -0,0 +1,105 @@
+// I suspect the stack overflow is occurring when the compiler is determining the types for the following line at the end of the file:-
+// val data = List(N26,N25)
+
+abstract class A
+{
+ // commenting out the following line (only) leads to successful compilation
+ protected val data: List[A]
+}
+
+trait B[T <: B[T]] extends A { self: T => }
+
+abstract class C extends A
+{
+ // commenting out the following line (only) leads to successful compilation
+ protected val data: List[C]
+}
+
+abstract class D extends C with B[D] {}
+
+abstract class Ee extends C with B[Ee]
+{
+}
+
+
+object N1 extends D
+{
+ val data = Nil
+}
+
+object N2 extends D
+{
+ val data = Nil
+}
+
+object N5 extends D
+{
+ val data = List(N1)
+}
+
+object N6 extends D
+{
+ val data = List(N1)
+}
+
+object N8 extends D
+{
+ val data = List(N1)
+}
+
+object N10 extends D
+{
+ val data = Nil
+}
+
+object N13 extends D
+{
+ val data = List(N2)
+}
+
+object N14 extends D
+{
+ val data = List(N5,N10,N8)
+}
+
+object N15 extends D
+{
+ val data = List(N14)
+}
+
+object N16 extends D
+{
+ val data = List(N13,N6,N15)
+}
+
+object N17 extends D
+{
+ val data = List(N16)
+}
+
+object N21 extends D
+{
+ val data = List(N16)
+}
+
+object N22 extends D
+{
+ val data = List(N17)
+}
+
+object N25 extends D
+{
+ val data = List(N22)
+}
+
+object N26 extends Ee
+{
+ val data = List(N21,N17)
+}
+
+// Commenting out the following object (only) leads to successful compilation
+object N31 extends Ee
+{
+ // If we use List[C](N26,N25), we achieve successful compilation
+ val data = List(N26,N25)
+}