summaryrefslogtreecommitdiff
path: root/test/files/pos/t3833.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/t3833.scala')
-rw-r--r--test/files/pos/t3833.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/pos/t3833.scala b/test/files/pos/t3833.scala
new file mode 100644
index 0000000000..c49e9339ca
--- /dev/null
+++ b/test/files/pos/t3833.scala
@@ -0,0 +1,26 @@
+object Main {
+ def mkArray[T <: A](atype: Int) :T#AType = {
+ (atype match {
+ case 1 =>
+ new Array[Int](10)
+ // Decompiled code: return (Object[])new int[10];
+ case 2 =>
+ new Array[Float](10)
+ }).asInstanceOf[T#AType]
+ }
+
+ def main(args: Array[String]) {
+ println(mkArray[I](1))
+ //java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
+ }
+}
+
+trait A {
+ type AType <: AnyRef
+}
+trait I extends A {
+ type AType = Array[Int]
+}
+trait F extends A {
+ type AType = Array[Float]
+}