summaryrefslogtreecommitdiff
path: root/test/files/run/t6271.scala
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-09-05 14:15:01 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-09-06 09:32:17 -0400
commit93d3cc703806bec34c4ef0c7817239966363c193 (patch)
treeed2834b1ba8df37c4e82462c541aaec9c230c278 /test/files/run/t6271.scala
parent2355b656e030a7b968aa02de9a688f565b147581 (diff)
downloadscala-93d3cc703806bec34c4ef0c7817239966363c193.tar.gz
scala-93d3cc703806bec34c4ef0c7817239966363c193.tar.bz2
scala-93d3cc703806bec34c4ef0c7817239966363c193.zip
Fixes SI-6271 - Missing isEmpty override for views.
GenIterableView didn't override isEmpty for views to look at *filtered* iterator, but was instead pulling unfiltered iterator and causing issues. Chalk up another bizzare bug to lack of insight/visibility into linearization and what havoc overriding new methods can spew on our library.
Diffstat (limited to 'test/files/run/t6271.scala')
-rw-r--r--test/files/run/t6271.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/files/run/t6271.scala b/test/files/run/t6271.scala
new file mode 100644
index 0000000000..8ebf7ad8b5
--- /dev/null
+++ b/test/files/run/t6271.scala
@@ -0,0 +1,32 @@
+object Test extends App {
+ def filterIssue = {
+ val viewed : Iterable[Iterable[Int]] = List(List(0).view).view
+ val filtered = viewed flatMap { x => List( x filter (_ > 0) ) }
+ filtered.iterator.toIterable.flatten
+ }
+ def takenIssue = {
+ val viewed : Iterable[Iterable[Int]] = List(List(0).view).view
+ val filtered = viewed flatMap { x => List( x take 0 ) }
+ filtered.iterator.toIterable.flatten
+ }
+ def droppedIssue = {
+ val viewed : Iterable[Iterable[Int]] = List(List(0).view).view
+ val filtered = viewed flatMap { x => List( x drop 1 ) }
+ filtered.iterator.toIterable.flatten
+ }
+ def flatMappedIssue = {
+ val viewed : Iterable[Iterable[Int]] = List(List(0).view).view
+ val filtered = viewed flatMap { x => List( x flatMap (_ => List()) ) }
+ filtered.iterator.toIterable.flatten
+ }
+ def slicedIssue = {
+ val viewed : Iterable[Iterable[Int]] = List(List(0).view).view
+ val filtered = viewed flatMap { x => List( x slice (2,3) ) }
+ filtered.iterator.toIterable.flatten
+ }
+ filterIssue
+ takenIssue
+ droppedIssue
+ flatMappedIssue
+ slicedIssue
+}