aboutsummaryrefslogtreecommitdiff
path: root/tests/run/viewtest.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-05-22 16:07:23 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-05-22 16:07:23 +0200
commit6965b470d433f501203c4e3d77b0919f826691ba (patch)
tree413446f1af3f40bb69499a60066609af6bc38d9f /tests/run/viewtest.scala
parent91bb668c5f1b6e5c51dad9b373c9398521508bc3 (diff)
downloaddotty-6965b470d433f501203c4e3d77b0919f826691ba.tar.gz
dotty-6965b470d433f501203c4e3d77b0919f826691ba.tar.bz2
dotty-6965b470d433f501203c4e3d77b0919f826691ba.zip
Enable 440 run tests that pass.
Note that some of them may pass due to several bugs that interfere.
Diffstat (limited to 'tests/run/viewtest.scala')
-rwxr-xr-xtests/run/viewtest.scala45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/run/viewtest.scala b/tests/run/viewtest.scala
new file mode 100755
index 000000000..398e0bd04
--- /dev/null
+++ b/tests/run/viewtest.scala
@@ -0,0 +1,45 @@
+object Test extends dotty.runtime.LegacyApp {
+ import collection._
+ val xs: SeqView[(String, Int), Seq[_]] = List("x").view.zip(Stream.from(0))
+ println(xs)
+
+ val ys = List(1, 2, 3).view map { x => println("mapping "+x); x + 1 }
+ println("ys defined")
+ println(ys.head)
+ println(ys.tail)
+ println(ys(2))
+ println(ys)
+ println(ys.force)
+
+ val zs = Array(1, 2, 3).view
+ val as: SeqView[Int, Array[Int]] = zs map (_ + 1)
+ val bs: Array[Int] = as.force
+ val cs = zs.reverse
+ cs(0) += 1
+ assert(cs.force.deep == Array(4, 2, 1).deep)
+ assert(zs(2) == 4)
+ assert(bs.deep == Array(2, 3, 4).deep)
+}
+
+/* crash confirmed.
+2.8 regression: CCE when zipping list projection with stream
+Reported by: szeiger Owned by: odersky
+Priority: normal Component: Standard Library
+Keywords: collections, zip Cc:
+Fixed in version:
+Description
+
+Welcome to Scala version 2.8.0.r18784-b20090925021043 (Java HotSpot(TM) Client VM, Java 1.6.0_11).
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> List("x").view.zip(Stream.from(0))List("x").view.zip(Stream.from(0))
+java.lang.ClassCastException: scala.collection.generic.IterableViewTemplate$$anon$8 cannot be cast to scala.collection.generic.SequenceView
+ at .<init>(<console>:5)
+ at .<clinit>(<console>)
+ at RequestResult$.<init>(<console>:4)
+ at RequestResult$.<clinit>(<console>)
+ at RequestResult$result(<console>)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.Nat...
+*/