Commit 74d7ae0
authored
Fix stale top level synthetic package object being used in later runs (#23464)
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.File tree
12 files changed
+48
-16
lines changed- compiler/src/dotty/tools/dotc/core
- tests
- neg
- i19351
- pos-macros
- i13821-a
- i13821-b
- i19351a
- i19351
12 files changed
+48
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2720 | 2720 | | |
2721 | 2721 | | |
2722 | 2722 | | |
2723 | | - | |
| 2723 | + | |
2724 | 2724 | | |
2725 | 2725 | | |
2726 | 2726 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
0 commit comments