Skip to content

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented Jul 9, 2020

Having buggy test tools is quite dangerous.

Backport of #9106, #9112

@scala-jenkins scala-jenkins added this to the 2.12.13 milestone Jul 9, 2020
val seq2 = List("third")
val it0: Iterator[Int] = Iterator(1, 2)
lazy val it: Iterator[String] = it0.flatMap {
case 1 => val r = seq1; seq1 = null; seq11 = r(1); r
Copy link
Member Author

@lrytz lrytz Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was wrong. Setting seq1 = null here actually "breaks" subsequent check calls. They are intended to check whether the array is reachable from the iterator, passing null was undermining the check. This was not caught because of the buggy assertThrows.

Instead of coming up with my own fix, I took the version from 2.13.

@lrytz lrytz force-pushed the assertUtilBackport branch from b64c566 to d80c414 Compare July 9, 2020 15:11
@som-snytt
Copy link
Contributor

I'll try to contribute a review when I have a free pomodoro.

I agree with the comment about test tools. But it's never fun futzing with old branches.

@SethTisue
Copy link
Member

scala.tools.testing.AssertThrowsTest.rethrowBar failed

Backport of PR 9106.

IteratorTest.`flatMap is memory efficient in previous element` was
copied from 2.13, as the 2.12 version was wrong (started failing with
the fixed `assertThrows`).

The change in AssertThrowsTest is backported from 4eab5e0.
@lrytz lrytz force-pushed the assertUtilBackport branch from d80c414 to b3c0fc0 Compare July 10, 2020 12:52
@lrytz
Copy link
Member Author

lrytz commented Jul 10, 2020

scala.tools.testing.AssertThrowsTest.rethrowBar failed

Backported the test fix from 4eab5e0679

@som-snytt
Copy link
Contributor

I feel like I haven't slept since December 2018 when I promised to put 👀 on it later or 🙄 ...

Previous version ought to have awaited the first
completed of, but using the parasitic context
should suffice; we check that with an assertion.
@lrytz
Copy link
Member Author

lrytz commented Jul 15, 2020

@som-snytt I included backports from #9112.

Copy link
Contributor

@som-snytt som-snytt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to try and fully understand the test. It must be right, right?

A good sign is that when I remove an unnecessary bit, the test fails.

@lrytz lrytz merged commit ac3fb5f into scala:2.12.x Jul 16, 2020
@SethTisue SethTisue added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal not resulting in user-visible changes (build changes, tests, internal cleanups)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants