Skip to content

Fixes #15830: Inline given with using parameter losing constant value#26020

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

Fixes #15830: Inline given with using parameter losing constant value#26020
soronpo wants to merge 1 commit into
scala:mainfrom
soronpo:claude/fix-scala-issue-15830-rw4LT

Conversation

@soronpo
Copy link
Copy Markdown
Contributor

@soronpo soronpo commented May 8, 2026

When inlining a method call on a receiver that itself was the result of inlining (e.g. summonInline of a given with using parameters), bindings of the inner inline are lifted out by liftBindings to wrap the outer inline. After further reduction the lifted bindings can become orphaned in the surrounding Block, defeating Expr#value/valueOrAbort because the constant expression is no longer recognized as such.

Drop lifted bindings that have a pure rhs and are unreferenced in the expansion, iterating to a fixpoint to handle chains of dependent bindings.

Fixes #15830

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

Extensively. This change looks scary. Let's see what the CI says. Don't know if I'll remove the draft.

How was the solution tested?

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

)

When inlining a method call on a receiver that itself was the result of
inlining (e.g. summonInline of a given with using parameters), bindings
of the inner inline are lifted out by liftBindings to wrap the outer
inline. After further reduction the lifted bindings can become orphaned
in the surrounding Block, defeating Expr#value/valueOrAbort because the
constant expression is no longer recognized as such.

Drop lifted bindings that have a pure rhs and are unreferenced in the
expansion, iterating to a fixpoint to handle chains of dependent bindings.
@soronpo soronpo changed the title Fixed #15830: Inline given with using parameter losing constant value Fixes #15830: Inline given with using parameter losing constant value May 8, 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.

Inline given with using parameter isn't properly inlined

2 participants