Scoverage: fix broken warnings related to tail recursion and infinite loop detection#25941
Merged
SolalPirelli merged 4 commits intoscala:mainfrom Apr 28, 2026
Merged
Conversation
Contributor
Author
|
CI is red due to |
SolalPirelli
approved these changes
Apr 28, 2026
Contributor
SolalPirelli
left a comment
There was a problem hiding this comment.
I guess this is a consequence of InstrumentCoverage having to be early because coverage needs to instrument code the user actually wrote rather than code the compiler produced after optimizations?
Contributor
Author
|
Yeah, quite a lot of issues are a consequence of the coverage phase being early and breaking the assumptions of the later phases. |
46ae818 to
e7deae3
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a bunch of warnings broken by scoverage related to tail recursion and infinite loops detection. Warnings were broken by:
The solution by phases affected:
InstrumentCoverage- phase that instruments the trees to inject coverage probes:ifconditions - they are getting in the way of rewritingifstatements with literal conditions into their respectivethenorelsebranches.CheckLoopingImplicits- phase that detects infinite loops in initializers:TailRec- phase that rewrites tail recursive calls into loops:isInfiniteRecCall- the method that detects infinite loops in tail recursive calls - to allow coverage probes as ones not capable of breaking an infinite loop.transform, modify the default getter index in recursive call argument position to peel through the coverage instrumentation to recover the original default-getter parameter index.How much have you relied on LLM-based tools in this contribution?
Moderately, for codebase analysis and tracing.
How was the solution tested?
sbt "testCompilation --enable-coverage-phase"