Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-8627 make Stream.filterNot non-eager
The obvious fix, overriding `filterNot` in Stream, is not binary compatible, see #3925 Instead, this makes `filterImpl` in TaversableLike private[scala], which allows overriding it in Stream. The corresponding mima-failures can be whitelisted, as the changes are only to private[scala]. In 2.12.x we can remove the override of `filter` in Stream, but in 2.11.x this is not binary compatible. Eventually we'd also like to make filter / filterNot in TraversableLike final, but that's not source compatible, so it cannot be done in 2.12.x.
- Loading branch information
Showing
5 changed files
with
138 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package scala.collection.immutable | ||
|
||
import org.junit.runner.RunWith | ||
import org.junit.runners.JUnit4 | ||
import org.junit.Test | ||
import org.junit.Assert._ | ||
|
||
@RunWith(classOf[JUnit4]) | ||
class StreamTest { | ||
|
||
@Test | ||
def t6727_and_t6440(): Unit = { | ||
assertTrue(Stream.continually(()).filter(_ => true).take(2) == Seq((), ())) | ||
assertTrue(Stream.continually(()).filterNot(_ => false).take(2) == Seq((), ())) | ||
assertTrue(Stream(1,2,3,4,5).filter(_ < 4) == Seq(1,2,3)) | ||
assertTrue(Stream(1,2,3,4,5).filterNot(_ > 4) == Seq(1,2,3,4)) | ||
} | ||
} |
aa5be82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job pr-scala failed for aa5be82 Took 240 min. (ping @lrytz) (results):
To retry exactly this commit, comment "PLS REBUILD/pr-scala@aa5be8202f2a87637e5f3139876bb235fc7afc94" on PR 3949.
NOTE: New commits are rebuilt automatically as they appear. A forced rebuild is only necessary for transient failures.