diff options
author | Martin Odersky <odersky@gmail.com> | 2016-01-31 14:03:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-09 09:43:05 +0100 |
commit | 9a6f82b2ecfd7462d0a1f4e0464878fd58231277 (patch) | |
tree | 8e9e46b08d7fdf45f4b1fd06b30d7e35c43f05b1 /tests/pos-scala2/t3833.scala | |
parent | 44c14b3fb6e5eb6f2b9734f092eef1d85f6b4d18 (diff) | |
download | dotty-9a6f82b2ecfd7462d0a1f4e0464878fd58231277.tar.gz dotty-9a6f82b2ecfd7462d0a1f4e0464878fd58231277.tar.bz2 dotty-9a6f82b2ecfd7462d0a1f4e0464878fd58231277.zip |
Reorganize tests to account for new typing of projection
Tests with failed projections are moved to pos-scala2, which
was renamed from pos-special. Files in pos-scala2 are compiled
with -language:Scala2 option.
Diffstat (limited to 'tests/pos-scala2/t3833.scala')
-rw-r--r-- | tests/pos-scala2/t3833.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/pos-scala2/t3833.scala b/tests/pos-scala2/t3833.scala new file mode 100644 index 000000000..2df658df1 --- /dev/null +++ b/tests/pos-scala2/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]): Unit = { + 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] +} |