summaryrefslogtreecommitdiff
path: root/test/files/run/bug4288.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-08 15:40:53 +0000
committerPaul Phillips <paulp@improving.org>2011-03-08 15:40:53 +0000
commit783721e98a4f61fc0c72298811b15e99c058d5e6 (patch)
treecdc0786526c572cfb9198942d517fbfd36ed0ba5 /test/files/run/bug4288.scala
parent8328a880b60ded33d5d49b88bdc75020b577eb27 (diff)
downloadscala-783721e98a4f61fc0c72298811b15e99c058d5e6.tar.gz
scala-783721e98a4f61fc0c72298811b15e99c058d5e6.tar.bz2
scala-783721e98a4f61fc0c72298811b15e99c058d5e6.zip
An overhaul of slice and related implementation...
An overhaul of slice and related implementations (primarily that is drop and take.) In the course of trying to get it working consistently (mostly with respect to negative indices, which were dealt with arbitrarily differently across the 25+ concrete implementations) I fixed various bugs. Closes #4288, no review.
Diffstat (limited to 'test/files/run/bug4288.scala')
-rw-r--r--test/files/run/bug4288.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/files/run/bug4288.scala b/test/files/run/bug4288.scala
new file mode 100644
index 0000000000..4e7b366f60
--- /dev/null
+++ b/test/files/run/bug4288.scala
@@ -0,0 +1,13 @@
+object Test {
+ def f1 = scala.collection.mutable.ListBuffer(1 to 9: _*).slice(-5, -1)
+ def f2 = scala.collection.mutable.ListBuffer(1 to 9: _*).readOnly.slice(-5, -1)
+ def f3 = Vector(1 to 9: _*).slice(-5, -1)
+ def f4 = Traversable(1 to 9: _*).slice(-5, -1)
+ def f5 = (1 to 9).toArray.slice(-5, -1)
+ def f6 = (1 to 9).toStream.slice(-5, -1)
+ def f7 = (1 to 9).slice(-5, -1)
+
+ def main(args: Array[String]): Unit = {
+ List[Traversable[Int]](f1, f2, f3, f4, f5, f6, f7) foreach (x => assert(x.isEmpty, x))
+ }
+}