Skip to content

Backport "Fixes #24414: Fix StaleSymbolException in Namer.addChild after compilation suspension" to 3.3 LTS - #1058

Open
tgodzik wants to merge 2 commits into
backport-lts-3.3-26227from
backport-lts-3.3-26019
Open

Backport "Fixes #24414: Fix StaleSymbolException in Namer.addChild after compilation suspension" to 3.3 LTS#1058
tgodzik wants to merge 2 commits into
backport-lts-3.3-26227from
backport-lts-3.3-26019

Conversation

@tgodzik

@tgodzik tgodzik commented Aug 6, 2026

Copy link
Copy Markdown

Backports scala#26019 to the 3.3.9.

PR submitted by the release tooling.
[skip ci]

@tgodzik
tgodzik force-pushed the backport-lts-3.3-26227 branch from 323cf93 to 0215e18 Compare August 7, 2026 15:53
claude and others added 2 commits August 7, 2026 17:54
When `addChild` inspects a parent's existing Child annotations, forcing
their lazy tree may dereference a child symbol from a previous run. If
compilation was suspended (due to inline/macro processing) and the child
class has been re-typechecked in the current run, the captured symbol is
stale and accessing its owner triggers `StaleSymbol`.

This manifests when a sealed parent is in a pre-compiled artifact and a
subclass in user code uses an inline given that causes suspension: the
parent's annotation list ends up holding a Child annotation pointing to
the suspended-run version of the subclass.

Treat such Child annotations as stale and drop them; the new run will
have re-registered the child anyway.

Fixes scala#24414

[Cherry-picked 3f30937]
Add a `NonStaleChild` extractor in `Annotations` that wraps `Child` with a
`StaleSymbol` catch, and use it in `Namer.addChild` so the surrounding
logic stays untouched.

[Cherry-picked 05d29fd][modified]
@tgodzik
tgodzik force-pushed the backport-lts-3.3-26019 branch from decf07b to 7679064 Compare August 7, 2026 15:54
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.

2 participants