-
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
Name Poisoning #4622
Comments
This was referenced Dec 4, 2024
bricknerb
added a commit
to bricknerb/carbon-lang
that referenced
this issue
Dec 6, 2024
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-merge-queue bot
pushed a commit
that referenced
this issue
Dec 6, 2024
This is a preparation change for adding name poisoning support (#4622), which is expected to require more elaborate logic around NameScope since a name can be not defined yet, defined, or poisoned. The API separates looking up a name from getting the full entry since we have cases where the entries are invalidated between the time we're looking for the name and when we access (and sometimes modify) the entry. This change has the following benefits: * `names` and `name_map` are internal to `NameScope` and are guaranteed to match. * `extended_scopes` and `import_ir_scopes` can not be manipulated (only new scopes can be added). * `inst_id`, `name_id` and `parent_scope_id` are constants. * `has_error` can only be mutated from false to true. --------- Co-authored-by: jonmeow <[email protected]>
bricknerb
added a commit
to bricknerb/carbon-lang
that referenced
this issue
Dec 9, 2024
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-merge-queue bot
pushed a commit
that referenced
this issue
Dec 17, 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`. --------- Co-authored-by: Dana Jansens <[email protected]> Co-authored-by: Richard Smith <[email protected]> Co-authored-by: Geoff Romer <[email protected]> Co-authored-by: Jon Ross-Perkins <[email protected]> Co-authored-by: josh11b <[email protected]> Co-authored-by: josh11b <[email protected]> Co-authored-by: Chandler Carruth <[email protected]> Co-authored-by: Carbon Infra Bot <[email protected]>
bricknerb
added a commit
to bricknerb/carbon-lang
that referenced
this issue
Jan 3, 2025
This prevents crashing when the wrongly used impl uses a poisoned name. carbon-language#4622
github-merge-queue bot
pushed a commit
that referenced
this issue
Jan 3, 2025
This prevents crashing when the wrongly used `impl` uses a poisoned name. #4622
bricknerb
added a commit
to bricknerb/carbon-lang
that referenced
this issue
Jan 7, 2025
…soned` bit instead of `InstId::PoisonedName` value. This would allow to more easily change the API to support accessing the poisoning delcaration so we can have better name poisoning diagnosis. carbon-language#4622
github-merge-queue bot
pushed a commit
that referenced
this issue
Jan 8, 2025
Change the implementation to use an explicit `is_poisoned` bit instead of `InstId::PoisonedName` value. Zero behavior change. This would allow to more easily change the API to support accessing the poisoning declaration so we can have better name poisoning diagnosis. #4622
bricknerb
added a commit
to bricknerb/carbon-lang
that referenced
this issue
Jan 8, 2025
bricknerb
added a commit
to bricknerb/carbon-lang
that referenced
this issue
Jan 8, 2025
github-merge-queue bot
pushed a commit
that referenced
this issue
Jan 14, 2025
Insert the poison at the same time we do the name lookup to avoid doing two hash table lookups into each scope. This adds a bit of complication because import logic now needs to cope with importing a name that is already poisoned, but the complexity seems worthwhile to reduce the number of name lookups performed. This incidentally fixes a bug where we wouldn't poison any name scopes if we found the name in an enclosing lexical scope, leading to one extra diagnostic in existing tests. Part of #4622
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: