-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Basic name poisoning support #4654
base: trunk
Are you sure you want to change the base?
Conversation
carbon-language#4622 When using an unqualified name disallow using that name in all scopes that would make it ambiguous in retrospect. Doesn't include support for poisoning when importing (see new test for that with TODO). Implemented by introduce `InstId::PoisonedName` and entries with it to `NameScope`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! This made me think a little more about what's needed to get a good diagnostic -- some comments inline, sorry I didn't think about that before.
toolchain/check/testdata/function/declaration/no_prelude/name_poisoning.carbon
Show resolved
Hide resolved
toolchain/check/testdata/function/declaration/no_prelude/name_poisoning.carbon
Outdated
Show resolved
Hide resolved
toolchain/check/testdata/function/declaration/no_prelude/name_poisoning.carbon
Show resolved
Hide resolved
toolchain/check/testdata/function/declaration/no_prelude/name_poisoning.carbon
Outdated
Show resolved
Hide resolved
* Use `llvm::SmallVector` instead of `std::vector`. * Put `DeclNameStack::NameContext::State::Poisoned` before `DeclNameStack::NameContext::State::Unresolved`. * Fix comment style and grammar. * Remove `InstId::PoisonedNameIndex`. * Use "non-poisoned" instead of "non poisoned".
…ote to the place where the name is declared after it was poisoned.
Can you take a look at the test failures? |
Sure, I couldn't reproduce this locally and couldn't find a diff between what I run locally and the failure. |
It's probably only failing after merging with trunk. |
#4622
When using an unqualified name, disallow declaring that name in all scopes that would make it ambiguous in retrospect.
Doesn't include support for poisoning in
impl library
(see new test for that with TODO).Implemented by introduce
InstId::PoisonedName
and entries with it toNameScope
.