Fix 25830 Inference of Capture-Polymorphic Lambdas#25853
Closed
bracevac wants to merge 2 commits intoscala:mainfrom
Closed
Fix 25830 Inference of Capture-Polymorphic Lambdas#25853bracevac wants to merge 2 commits intoscala:mainfrom
bracevac wants to merge 2 commits intoscala:mainfrom
Conversation
9988b87 to
a3b38c9
Compare
bracevac
commented
Apr 20, 2026
| needsVariable(parent) | ||
| && refs.isConst // if refs is a variable, no need to add another | ||
| && !refs.isUniversal // if refs is {caps.any}, an added variable would not change anything | ||
| && !refs.elems.exists(_.coreType.derivesFromCapSet) |
Contributor
Author
There was a problem hiding this comment.
@odersky the exists instead of forall is for the case we have mixed retains of the form {C, x}.
Originally added in scala#24560 to strip inferred retains from inlined call trees before they reach the pickler. The cc setup pipeline now handles retains correctly without this preemptive strip, and removing it leaves scala3-bootstrapped/testCompilation green.
Fixes scala#25830. Covers plain poly lambdas, curried lambdas, mixed outer/local scopes, capset type members, and bounded polymorphism (see tests/pos-custom-args/captures/i25830*).
a3b38c9 to
5e426bf
Compare
Contributor
Author
|
Continues in #25905 |
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 #25830
Alternative to #25833
How much have you relied on LLM-based tools in this contribution?
Extensively, for everything.
How was the solution tested?
New automated tests (including the issue's reproducer, if applicable)