Iterate where: explanations to fixed point#25851
Open
mbovel wants to merge 2 commits intoscala:mainfrom
Open
Conversation
Rendering an explanation for a recorded type may itself record new entries (e.g. a type variable's constraint mentioning another type variable). Collect explanations in a loop so every referenced entry appears in the where clause.
where: explanations to fixed point
Member
Author
|
Assigning you @natsukagami because GitHub suggested so. Would you agree to review? 🙂 |
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.
When a recorded type's explanation in the
where:clause mentions another recorded type that also needs explanation, the latter is silently dropped. This happens becauseexplanationscollects the entries to explain once, up front, and then renders each one; rendering an explanation for entryXmay callParamRefNameString(or similar) on entries nested insideX's bounds, which adds them toseen— but too late for the pass that produced the final output.Concretely, for
we used to get:
with no explanation for
V. After this change:The fix is to iterate the explanation loop to a fixed point: as long as rendering an explanation causes a new entry to be recorded, collect and explain it in the next round. This also surfaces a number of previously missing explanations in capture-checking error messages (nested
^², anonymous-function parameters, etc.), which account for the bulk of the checkfile updates.How much have you relied on LLM-based tools in this contribution?
Extensively, for everything.
How was the solution tested?
One new test showing the change, plus existing checkfiles updates.