Skip to content
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

Open
wants to merge 20 commits into
base: trunk
Choose a base branch
from

Conversation

bricknerb
Copy link
Contributor

@bricknerb bricknerb commented Dec 9, 2024

#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 to NameScope.

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`.
@github-actions github-actions bot requested a review from jonmeow December 9, 2024 13:44
Copy link
Contributor

@jonmeow jonmeow left a 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/sem_ir/name_scope.h Outdated Show resolved Hide resolved
toolchain/sem_ir/name_scope.cpp Outdated Show resolved Hide resolved
toolchain/check/decl_name_stack.cpp Outdated Show resolved Hide resolved
toolchain/check/handle_class.cpp Outdated Show resolved Hide resolved
toolchain/check/context.cpp Outdated Show resolved Hide resolved
toolchain/check/context.cpp Outdated Show resolved Hide resolved
@bricknerb bricknerb requested a review from jonmeow December 10, 2024 10:29
toolchain/sem_ir/name_scope.h Outdated Show resolved Hide resolved
toolchain/sem_ir/name_scope.h Outdated Show resolved Hide resolved
toolchain/sem_ir/name_scope.h Outdated Show resolved Hide resolved
toolchain/sem_ir/name_scope.h Outdated Show resolved Hide resolved
@bricknerb bricknerb requested a review from jonmeow December 10, 2024 21:26
toolchain/check/context.cpp Outdated Show resolved Hide resolved
toolchain/check/context.cpp Outdated Show resolved Hide resolved
…ote to the place where the name is declared after it was poisoned.
@jonmeow jonmeow enabled auto-merge December 12, 2024 22:23
@bricknerb bricknerb requested a review from jonmeow December 13, 2024 05:46
@jonmeow
Copy link
Contributor

jonmeow commented Dec 13, 2024

Can you take a look at the test failures?

@bricknerb
Copy link
Contributor Author

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.
I obviously do something wrong here.
Do you have any pointers how can I reproduce this?

@zygoloid
Copy link
Contributor

It's probably only failing after merging with trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants