Skip to content

Fixes #25806: Eta-expand partial app of integrated context-function result#26030

Draft
soronpo wants to merge 1 commit into
scala:mainfrom
soronpo:claude/fix-scala-issue-25806-X3LHW
Draft

Fixes #25806: Eta-expand partial app of integrated context-function result#26030
soronpo wants to merge 1 commit into
scala:mainfrom
soronpo:claude/fix-scala-issue-25806-X3LHW

Conversation

@soronpo
Copy link
Copy Markdown
Contributor

@soronpo soronpo commented May 9, 2026

When an inline method is expanded with a concrete context-function type substituted for an abstract result type, the call site can be left with a call to a method whose @ContextResultCount-integrated signature has more parameters than the call supplies (because the result is consumed as a context-function value rather than immediately applied). At erasure, adaptToType previously asserted on this case. Instead, recover by eta-expanding the partial application to a closure that supplies the missing parameters, merging the new arguments into the existing call chain so later phases see a fully-applied inner Apply.

Fixes #25806

How much have you relied on LLM-based tools in this contribution?

Extensively. Looks to be a significant change. Let's first see what the CI says, and I may decide to take it out of a draft state.

How was the solution tested?

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

…n result

When an inline method is expanded with a concrete context-function type
substituted for an abstract result type, the call site can be left with
a call to a method whose `@ContextResultCount`-integrated signature has
more parameters than the call supplies (because the result is consumed
as a context-function value rather than immediately applied). At
erasure, `adaptToType` previously asserted on this case. Instead,
recover by eta-expanding the partial application to a closure that
supplies the missing parameters, merging the new arguments into the
existing call chain so later phases see a fully-applied inner Apply.
@soronpo soronpo changed the title Fix #25806: eta-expand partial app of integrated context-function result Fix #25806: Eta-expand partial app of integrated context-function result May 9, 2026
@soronpo soronpo changed the title Fix #25806: Eta-expand partial app of integrated context-function result Fixes #25806: Eta-expand partial app of integrated context-function result May 9, 2026
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.

Smuggling a context function through a higher-kinded typeclass in an inline method crashes with assertion failed: bad adapt

2 participants