summaryrefslogtreecommitdiff
path: root/test/pending/run/bug412.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/pending/run/bug412.scala')
-rw-r--r--test/pending/run/bug412.scala33
1 files changed, 33 insertions, 0 deletions
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();
+ }
+
+}