Conversation
Morriar
approved these changes
Jan 27, 2026
| assert_eq!( | ||
| vec
We originally took a shortcut for representing top level constant references. We were simply ignoring (and effectively erasing) its nesting information. This works for almost everything, but it unfortunately falls short for the case of completion.
For example:
In this example, both cases of
Barrefers to the same class, but the lexical scope in which they are inserted in is different. The first::Barhas access toFoo::CONSTthrough lexical scope and the secondBardoes not.We can't support this correctly without remembering the original nesting for constant references while at the same time recording that we found a top level reference.
Implementation
I tested two approaches:
ParentScope. This gives us type safety as the compiler forces us to handle each case.NameIdfor a fake name<!top-level!>. To my surprise, based onmem::size_ofand our benchmarks on Core, there's no memory difference with the extra enumBecause of this, I went with the new enum, so that we can have extra type safety.