Fix 25830 Inference of Capture-Polymorphic Lambdas v3#25905
Closed
bracevac wants to merge 6 commits intoscala:mainfrom
Closed
Fix 25830 Inference of Capture-Polymorphic Lambdas v3#25905bracevac wants to merge 6 commits intoscala:mainfrom
bracevac wants to merge 6 commits intoscala:mainfrom
Conversation
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*).
8c4736e to
4f2f871
Compare
Contributor
Author
|
Superseded by #25936 |
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.
Fix #25830
Supersedes #25853
This changeset fixes cases where the compiler forgot capture information while inferring the type of capture-polymorphic lambdas, especially lambdas like [C^] => (x: File^{C}) => ....
The main idea is to keep capture parameters when they are part of the lambda’s actual type. At the same time, it avoids keeping ordinary local values too precisely in inferred type arguments, because that can hide real leaks.
It also teaches lambda checking to use the expected result type in more cases.
How much have you relied on LLM-based tools in this contribution?
Extensively, for fun.
How was the solution tested?
New automated tests (including the issue's reproducer, if applicable)