diff options
author | Josh Suereth <joshua.suereth@gmail.com> | 2012-05-08 21:09:25 -0400 |
---|---|---|
committer | Josh Suereth <joshua.suereth@gmail.com> | 2012-05-08 21:09:25 -0400 |
commit | a516098d4ed774c5ff4f53ef22ed8eb90dc1b8d5 (patch) | |
tree | dc83defdc922a580170a5d49529a9db4b0a7b8b4 /src/library | |
parent | da04d691c455aa3f3391bdbd9bac7fb59f29cedf (diff) | |
download | scala-a516098d4ed774c5ff4f53ef22ed8eb90dc1b8d5.tar.gz scala-a516098d4ed774c5ff4f53ef22ed8eb90dc1b8d5.tar.bz2 scala-a516098d4ed774c5ff4f53ef22ed8eb90dc1b8d5.zip |
Fixes SI-5201. Adds flatten to TraversableViewLike.
Note: This commit exposes a pretty rich type on flatten in views. HOWEVER, because we don't
capture the higher kinded type of the underlying collection, it makes returning a more minimal type
pretty dang hard. I can imagine a very breaking and painful change of capturing the underling
collection as a higher-kinded type as well as the current view type in a *ViewLike.scala.
I hope this kind of issue, along with others, drives a rethink of our view API design.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/TraversableViewLike.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/library/scala/collection/TraversableViewLike.scala b/src/library/scala/collection/TraversableViewLike.scala index 5ca038fd2e..eb2091a5f3 100644 --- a/src/library/scala/collection/TraversableViewLike.scala +++ b/src/library/scala/collection/TraversableViewLike.scala @@ -162,6 +162,8 @@ trait TraversableViewLike[+A, // if (b.isInstanceOf[NoBuilder[_]]) newFlatMapped(f).asInstanceOf[That] // else super.flatMap[B, That](f)(bf) } + override def flatten[B](implicit asTraversable: A => /*<:<!!!*/ GenTraversableOnce[B]) = + newFlatMapped(asTraversable) private[this] implicit def asThis(xs: Transformed[A]): This = xs.asInstanceOf[This] /** Boilerplate method, to override in each subclass |