From b9785280a7138a2bb52060faf94807aa0d07dec1 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 24 Aug 2011 17:11:55 +0000 Subject: Renamed tests named bugXXX to tXXX, no review. --- test/files/neg/t412.scala | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/files/neg/t412.scala (limited to 'test/files/neg/t412.scala') diff --git a/test/files/neg/t412.scala b/test/files/neg/t412.scala new file mode 100644 index 0000000000..54cd90da1c --- /dev/null +++ b/test/files/neg/t412.scala @@ -0,0 +1,31 @@ +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 >: Null; + val c: CX with C2 = null; + + 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(); + } + +} -- cgit v1.2.3