Skip to content

Backport "Fix coverage serialization when encountering macro suspension " to 3.3 LTS #175

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

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Mar 14, 2025

Backports scala#22303 to the 3.3.6.

PR submitted by the release tooling.
[skip ci]

jchyb and others added 2 commits March 14, 2025 19:10
…22303)

Fixes scala#22247

The fix is simple, as we mainly move the coverage object to a global
ContextBase object, which persists it between runs. Initially I thought
that appending the newly generated coverage indices would be enough, but
if the macro suspends after the InstrumentCoverage phase runs, we end up
with duplicate indices. For that reason, when generating indexes for a
compilation unit, we also remove the previously generated ones for the
same compilation unit.

To support having multiple scala files compiled in the coverage tests I
had to slightly adjust the suite. While doing that, I noticed that some
check files for run tests were ignored, as they were incorrectly named.
I added an assertion that throws when `.check` do not exist and renamed
the files appropriately (having to add some additional ones as well).
…22303)

Fixes scala#22247

The fix is simple, as we mainly move the coverage object to a global
ContextBase object, which persists it between runs. Initially I thought
that appending the newly generated coverage indices would be enough, but
if the macro suspends after the InstrumentCoverage phase runs, we end up
with duplicate indices. For that reason, when generating indexes for a
compilation unit, we also remove the previously generated ones for the
same compilation unit.

To support having multiple scala files compiled in the coverage tests I
had to slightly adjust the suite. While doing that, I noticed that some
check files for run tests were ignored, as they were incorrectly named.
I added an assertion that throws when `.check` do not exist and renamed
the files appropriately (having to add some additional ones as well).
[Cherry-picked f06b95f][modified]
@tgodzik
Copy link
Author

tgodzik commented Mar 18, 2025

No regressions detected in the community build up to backport-lts-3.3-22366.

Reference

@tgodzik tgodzik merged commit bbad660 into lts-3.3 Mar 18, 2025
22 checks passed
@tgodzik tgodzik deleted the backport-lts-3.3-22303 branch March 18, 2025 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants