From 1259651a7ded65809d63d6b2744d4d097cc90ead Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 31 Dec 2010 08:52:12 +0000 Subject: 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 :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. --- test/files/run/flat-flat-flat.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/files/run/flat-flat-flat.scala (limited to 'test/files/run/flat-flat-flat.scala') 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)) + } +} -- cgit v1.2.3