Skip to content

Fix summonInline deferred inline selection#26002

Open
DmytroMitin wants to merge 2 commits into
scala:mainfrom
DmytroMitin:fix-23134-summoninline-singleton
Open

Fix summonInline deferred inline selection#26002
DmytroMitin wants to merge 2 commits into
scala:mainfrom
DmytroMitin:fix-23134-summoninline-singleton

Conversation

@DmytroMitin
Copy link
Copy Markdown

Fixes #23134

When summonInline[A] is used as the qualifier of an inline member
selection, the selection can initially be typed against the requested
abstract type A. After summonInline expands to the actual implicit
evidence, the qualifier may have a more precise singleton/refined type,
but the select can still keep the stale deferred inline symbol from A.

This caused inlining to fail with:

Deferred inline method foo in trait A cannot be invoked

This patch repairs that stale select during inline retyping, but only
when the reselected member is uniquely proven to be the concrete
implementation of the originally selected deferred inline member.
The guard uses existing override machinery and filters alternatives
instead of relying on name-only lookup.

Regression coverage includes:

  • the minimized original issue,
  • overloaded concrete evidence,
  • refined/path-dependent result types,
  • precise non-singleton return types,
  • refined type members with literal and Int results.

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

Moderately, for investigation support, adversarial review, and iterative refinement of the localized compiler fix and regression tests. The implementation, validation, and final review of the patch were performed manually.

How was the solution tested?

New automated tests (including the issue's reproducer)

Validated with:

sbt --client testCompilation i23134
sbt --client testCompilation summonInline
sbt --client testCompilation

I also attempted:

sbt --client scala3-bootstrapped/test

but it failed in apparently unrelated staging/repl/JDK/Scala.js test tasks before giving useful signal for this patch.

@DmytroMitin
Copy link
Copy Markdown
Author

I signed the CLA

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.

Is it expected that summonInline seems to return not as precise type as summon?

1 participant