summaryrefslogtreecommitdiff
path: root/test/files/run/array-existential-bound.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-06 15:51:09 -0800
committerPaul Phillips <paulp@improving.org>2012-01-06 19:35:33 -0800
commitd6346f7c567894e635d92fe9408d2b340c93b9b4 (patch)
tree27639968bcb682eec97df6d7fc2d57cdb65b4c4a /test/files/run/array-existential-bound.scala
parentf39537a369e3b137f5b1bef21cc8f5d86bc9d9d8 (diff)
downloadscala-d6346f7c567894e635d92fe9408d2b340c93b9b4.tar.gz
scala-d6346f7c567894e635d92fe9408d2b340c93b9b4.tar.bz2
scala-d6346f7c567894e635d92fe9408d2b340c93b9b4.zip
Fix for crasher where Arrays meet abstract types.
This sort of thing was crashing. No longer. trait Fooz[Q <: Array[_]] { def f0(x: Q) = x.length }
Diffstat (limited to 'test/files/run/array-existential-bound.scala')
-rw-r--r--test/files/run/array-existential-bound.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala
new file mode 100644
index 0000000000..bc442d39f7
--- /dev/null
+++ b/test/files/run/array-existential-bound.scala
@@ -0,0 +1,17 @@
+trait Fooz[Q <: Array[_]] {
+ def f0(x: Q) = x.length
+}
+
+object Test extends Fooz[Array[Int]] {
+ val f1 = new Fooz[Array[String]] { }
+ val f2 = new Fooz[Array[Int]] { }
+ val f3 = new Fooz[Array[Any]] { }
+ val f4 = new Fooz[Array[_]] { }
+
+ def main(args: Array[String]): Unit = {
+ println(f1.f0(Array[String]("a", "b")))
+ println(f2.f0(1 to 1000 toArray))
+ println(f3.f0((1 to 1000).toArray[Any]))
+ println(f4.f0('a' to 'z' toArray))
+ }
+}