summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-10-10 01:25:54 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-10-10 01:25:54 -0700
commit36e56bca7f96eca3c7c11118aada32b5f37621c0 (patch)
treecbad846d3f5afb42a1bd4f9d244145a569591871
parente5127d94ef02cf71fdb9b95b24f8135c49d135ae (diff)
parent7a6905dc158a7a543ba3f4ddeeffe538580958d3 (diff)
downloadscala-36e56bca7f96eca3c7c11118aada32b5f37621c0.tar.gz
scala-36e56bca7f96eca3c7c11118aada32b5f37621c0.tar.bz2
scala-36e56bca7f96eca3c7c11118aada32b5f37621c0.zip
Merge pull request #1483 from gkossakowski/SI-6440
SI-6440: Revert change to `TraversableLike.filterNot`
-rw-r--r--src/library/scala/collection/TraversableLike.scala7
-rw-r--r--test/files/run/t6440.check1
-rw-r--r--test/files/run/t6440.scala7
3 files changed, 9 insertions, 6 deletions
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index ce0b130b86..7849f1c544 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -271,12 +271,7 @@ trait TraversableLike[+A, +Repr] extends Any
* @return a new $coll consisting of all elements of this $coll that do not satisfy the given
* predicate `p`. The order of the elements is preserved.
*/
- def filterNot(p: A => Boolean): Repr = {
- val b = newBuilder
- for (x <- this)
- if (!p(x)) b += x
- b.result
- }
+ def filterNot(p: A => Boolean): Repr = filter(!p(_))
def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
diff --git a/test/files/run/t6440.check b/test/files/run/t6440.check
new file mode 100644
index 0000000000..b5684daee4
--- /dev/null
+++ b/test/files/run/t6440.check
@@ -0,0 +1 @@
+Stream((), ?)
diff --git a/test/files/run/t6440.scala b/test/files/run/t6440.scala
new file mode 100644
index 0000000000..2b690f31e1
--- /dev/null
+++ b/test/files/run/t6440.scala
@@ -0,0 +1,7 @@
+object Test {
+
+ def main(args: Array[String]): Unit = {
+ println(Stream.continually(()).filterNot(_ => false).take(2))
+ }
+
+}