summaryrefslogtreecommitdiff
path: root/test/files/run/flat-flat-flat.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-31 08:52:12 +0000
committerPaul Phillips <paulp@improving.org>2010-12-31 08:52:12 +0000
commit1259651a7ded65809d63d6b2744d4d097cc90ead (patch)
treea1cecb7281c3aad8f00fdd20d85474feb77c8e36 /test/files/run/flat-flat-flat.scala
parent740fcf90bd7bfe4d4c322d2c7912e4df04200d90 (diff)
downloadscala-1259651a7ded65809d63d6b2744d4d097cc90ead.tar.gz
scala-1259651a7ded65809d63d6b2744d4d097cc90ead.tar.bz2
scala-1259651a7ded65809d63d6b2744d4d097cc90ead.zip
Even after the mostly blissful marriage of Trav...
Even after the mostly blissful marriage of Traversable and Iterator there was some fussin' and fightin' over who should have to care for Option. Now there is peace among the collections once again. // before scala> Iterator(Some(1), None).flatten <console>:6: error: value flatten is not a member of Iterator[Option[Int]] // after scala> Iterator(Some(1), None).flatten res0: Iterator[Int] = non-empty iterator Review by moors.
Diffstat (limited to 'test/files/run/flat-flat-flat.scala')
-rw-r--r--test/files/run/flat-flat-flat.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/run/flat-flat-flat.scala b/test/files/run/flat-flat-flat.scala
new file mode 100644
index 0000000000..80868b9c5e
--- /dev/null
+++ b/test/files/run/flat-flat-flat.scala
@@ -0,0 +1,11 @@
+object Test {
+ def f1 = List(Iterator(Some(1), None, Some(2)), Iterator(Some(3), None))
+ def f2 = Iterator(List(Some(1), None, Some(2)), List(Some(3), None), Nil)
+ def f3 = List(Some(Iterator(1)), None, Some(Iterator(2, 3)))
+
+ def main(args: Array[String]): Unit = {
+ assert(f1.flatten.flatten.toList == List(1, 2, 3))
+ assert(f2.flatten.flatten.toList == List(1, 2, 3))
+ assert(f3.flatten.flatten.toList == List(1, 2, 3))
+ }
+}