summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-04-04 12:18:15 +0000
committerMartin Odersky <odersky@gmail.com>2006-04-04 12:18:15 +0000
commitac8b46abda17de619beb2b27dfe9d820c5e189cf (patch)
treeb908b07eb95280352dea767dd0fd8ac9890d8472 /test
parent486042e89abaa69b82f2d602d342f7b032ce7047 (diff)
downloadscala-ac8b46abda17de619beb2b27dfe9d820c5e189cf.tar.gz
scala-ac8b46abda17de619beb2b27dfe9d820c5e189cf.tar.bz2
scala-ac8b46abda17de619beb2b27dfe9d820c5e189cf.zip
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/bug412.check6
-rw-r--r--test/files/neg/bug412.scala (renamed from test/pending/neg/bug412.scala)0
-rw-r--r--test/pending/pos/bug563.scala7
-rw-r--r--test/pending/run/bug412.scala33
4 files changed, 46 insertions, 0 deletions
diff --git a/test/files/neg/bug412.check b/test/files/neg/bug412.check
new file mode 100644
index 0000000000..6caf74fb3d
--- /dev/null
+++ b/test/files/neg/bug412.check
@@ -0,0 +1,6 @@
+bug412.scala:9 error: type mismatch;
+ found : scala.AllRef(null)
+ required: A.this.CX with A.this.C2
+ val c: CX with C2 = null;
+ ^
+one error found
diff --git a/test/pending/neg/bug412.scala b/test/files/neg/bug412.scala
index 66de4761fb..66de4761fb 100644
--- a/test/pending/neg/bug412.scala
+++ b/test/files/neg/bug412.scala
diff --git a/test/pending/pos/bug563.scala b/test/pending/pos/bug563.scala
new file mode 100644
index 0000000000..d559226bdb
--- /dev/null
+++ b/test/pending/pos/bug563.scala
@@ -0,0 +1,7 @@
+object Test {
+ def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f);
+
+ def split(sn : Iterable[List[Cell[int]]]) : unit =
+ for (val n <- sn)
+ map(n,ptr => new Cell(ptr.elem));
+}
diff --git a/test/pending/run/bug412.scala b/test/pending/run/bug412.scala
new file mode 100644
index 0000000000..4610235427
--- /dev/null
+++ b/test/pending/run/bug412.scala
@@ -0,0 +1,33 @@
+object Magic {
+
+ abstract class A[T1,T2]() {
+ trait C { type T; }
+ trait C1 extends C { type T = T1; }
+ trait C2 extends C { type T <: T2; }
+
+ type CX;
+
+ var cv: CX with C2 = _;
+ val c: CX with C2 = cv;
+
+ def castA(x: c.T): T2 = x;
+ }
+
+ class B[T1,T2] extends A[T1,T2]() {
+ type CX = C1;
+
+ def castB(x: T1): T2 = castA(x);
+ }
+
+ def cast[T1,T2](v: T1): T2 =
+ new B[T1,T2]().castB(v)
+
+}
+
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ Magic.cast[String,Exception]("xyz").printStackTrace();
+ }
+
+}