Skip to content

Fix stale top level synthetic package object being used in later runs #23464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jchyb
Copy link
Contributor

@jchyb jchyb commented Jul 2, 2025

Fixes #13821
To explain what was happening:
We previously got a completion assertion crash, because a stale symbol (val candidate) was brought forward into a new run, even though it should not have been, when searching for implicits. This was caused by the synthetic top level package object (file$package, generated only when top level definitions require it to, which is why the issue appeared only when type DFBits = Long was present) passing stillValid check, despite not being found in the Symbols owned by owner (package <empty>). This would cause all of the stale members of that to also be brought forward (as they would fulfill the requirements of stillValidInOwner).

The stale top level package would incorrectly pass the (denot.is(Synthetic) && denot.is(ModuleClass) && stillValidInOwner(denot.companionClass)) check in stillValidInOwner, despite companionClass of that package object being a noSymbol. Now we also check if companionClass is a noSymbol explicitly to avoid this issue.

@soronpo
Copy link
Contributor

soronpo commented Jul 2, 2025

OMG, it's amazing such huge pain and weird error gets such a small fix. I see there are tests regressions, so the jury is still out on the size and nature of the fix, but thank you for looking into it.

They were previously fixed from crashing to erroring state, now
compiling.
The cause of the previous crashes looks the same as the one fixes in
this PR, where the stale synthetic top level package object would be
brought forward, causing other stale symbols to be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants