Skip to content

Keep references to local capsets in inferred types - #26879

Open
bracevac wants to merge 1 commit into
scala:mainfrom
dotty-staging:ob/fix-26000
Open

Keep references to local capsets in inferred types#26879
bracevac wants to merge 1 commit into
scala:mainfrom
dotty-staging:ob/fix-26000

Conversation

@bracevac

Copy link
Copy Markdown
Member

Fixes #26000

#25976 preserved ^{C} by marking closure parameters @declared in PostTyper, but only when the lambda is the direct RHS of a named definition.
It notably can't reach lambdas whose types end up in inferred types via arguments like Box([C^] => ...).

This fix adds a type-level rule to both cleanup passes: a retains set referencing a type-lambda binder that lives inside the inferred type itself is provably un-re-inferable, so it's kept and processed as a declared type

Have you relied on LLM-based tools in this contribution?

Yes, and I checked the output by guiding and reviewing it.

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

& testing in the REPL via ./bin/replQ.

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.

CC: More trouble with capture-polymorphic lambdas

1 participant