Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream#filterNot broken, should be overridden in Stream #8627

Closed
scabug opened this issue May 27, 2014 · 23 comments
Closed

Stream#filterNot broken, should be overridden in Stream #8627

scabug opened this issue May 27, 2014 · 23 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 27, 2014

Similar issue to #3265
filter is overridden in Stream whereas filterNot is implemented in TransversableLike. This implementation is not working for Stream in 2.11.0 and 2.11.1. It was working in previous versions (2.10.0 and 2.9.2 tested)

 scala> Stream.from(1).filter(_ > 5)
res2: scala.collection.immutable.Stream[Int] = Stream(6, ?)

scala> Stream.from(1).filterNot(_ <= 5)
java.lang.OutOfMemoryError: Java heap space
  at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:170)
  at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:45)
@scabug
Copy link
Author

scabug commented May 27, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8627?orig=1
Reporter: Chris Howitt (chowitt)
Affected Versions: 2.11.0, 2.11.1, 2.11.4
See #3265, #8552

@scabug
Copy link
Author

scabug commented May 27, 2014

Chris Howitt (chowitt) said:
Looks like this has been broken and fixed before:
#6440
scala/scala@7a6905d
There's even a test: test/files/run/t6440.scala

Here is the commit that broke this again:
scala/scala@3059e3a#diff-4b8694484188574dce55135fd0bc9ae5

@scabug
Copy link
Author

scabug commented Aug 10, 2014

@ruippeixotog said:
I have just issued a pull request for this:
scala/scala#3925

@scabug
Copy link
Author

scabug commented Aug 27, 2014

@gkossakowski said:
Fixed in scala/scala#3949

@scabug
Copy link
Author

scabug commented Nov 28, 2014

Venkatesh Umaashankar (vumaasha) said:
it looks like this is again broken in 2.11.4, I am trying this in scala REPL and it does not work. I am not sure if I should log a new bug?

@scabug
Copy link
Author

scabug commented Nov 28, 2014

@gkossakowski said:
The change that fixed this ticket has been reverted in: scala/scala#4048

We forgot to reopen the corresponding issue.

@scabug
Copy link
Author

scabug commented Nov 28, 2014

@Ichoran said:
@lrytz Did you want to fix this one, or shall I grab it?

@scabug
Copy link
Author

scabug commented Dec 1, 2014

@lrytz said:
@Ichoran I'm Happy to hand it off :-)

@scabug
Copy link
Author

scabug commented Dec 1, 2014

@Ichoran said:
@lrytz I guess I should go for the ugly hack that fixes it in 2.11.5 rather than waiting for 2.12? Or shall we just say this one's buggered 'til then?

@scabug
Copy link
Author

scabug commented Dec 1, 2014

@lrytz said:
I'd also go for the fix in 2.11.5.

@scabug
Copy link
Author

scabug commented Jan 2, 2015

@adriaanm said:
AFAICT, still pending because the original fix was not binary compatible. Should we retarget to 2.12?

@scabug
Copy link
Author

scabug commented Jan 2, 2015

@Ichoran said:
@adriaanm I need to do more extensive testing to see if we will clobber performance too greatly in 2.11 if we fix this the way that will work with binary compatibility (i.e. intercept it in the superclass). Since this is a potentially dangerous change, I want to make sure to test in a variety of scenarios (e.g. with and without multiple dispatch). I will retarget if the results of testing are disappointing.

@scabug
Copy link
Author

scabug commented Jan 3, 2015

@Ichoran said:
@adriaanm Not fixable in 2.11 without significant performance penalty (up to about 40% slowdown in List.filterNot on single-element lists). Deferring to 2.12. How can we document this so that the lack of laziness of filterNot is discoverable in 2.11?

@scabug
Copy link
Author

scabug commented Jan 3, 2015

@Ichoran said:
[~lrytz] Your previous fix (already applied in 2.12) looks good modulo leaving the stub override of filter in Stream. When I figure out whether I can fix the docs without overriding anything I'll add a small additional patch. This should resolve this ticket. (I may also collapse the separate function--not really a compelling reason for it any more.)

@scabug
Copy link
Author

scabug commented Feb 6, 2015

@cvogt said:
reproduced in 2.11.4

@scabug
Copy link
Author

scabug commented Feb 6, 2015

@cvogt said:
This is a regression. There should be a test Stream.from(1).filterNot(_ <= 5)

@scabug
Copy link
Author

scabug commented Feb 7, 2015

@Ichoran said:
@cvogt The fix version is 2.12.0-M1. 2.11.everything is going to be affected because, as explained above, it cannot be fixed unless we either break binary compatibility or introduce major performance penalties on other collections.

And yes, of course, the offending line in the bug report will go in a test.

@scabug
Copy link
Author

scabug commented Apr 22, 2015

@adriaanm said:
scala/scala#4429

@scabug
Copy link
Author

scabug commented Apr 30, 2015

Espen Wiborg (espenhw) said:
AFAICT the referenced pull request does not fix this issue; instead it fixes #8552

@scabug
Copy link
Author

scabug commented Apr 30, 2015

@Ichoran said:
[~espenhw] Thanks for catching that! I've updated the tickets accordingly.

@scabug
Copy link
Author

scabug commented Jul 8, 2015

@SethTisue said:
This appears to work in 2.12.0-M1, presumably thanks to scala/scala#4284

@scabug scabug closed this as completed Jul 8, 2015
@scabug
Copy link
Author

scabug commented Jul 8, 2015

@SethTisue said:
test coverage: scala/scala#4611

@scabug
Copy link
Author

scabug commented Jul 16, 2015

@lrytz said (edited on Jul 16, 2015 9:05:54 AM UTC):
i think the commit that fixed this ticked in 2.12.x is scala/scala#3949 (which was merged forward into 2.12.x). The commit was later reverted in 2.11.x due to binary incompatibility (scala/scala#4048), but the revert was annotated [nomerge], which means it was merged into 2.12.x with -s ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants