-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Name Poisoning #4622
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
Comments
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.
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]>
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`.
#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]>
This prevents crashing when the wrongly used impl uses a poisoned name. carbon-language#4622
This prevents crashing when the wrongly used `impl` uses a poisoned name. #4622
…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
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
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
`InstId` cannot be poisoned since carbon-language#4764. Part of carbon-language#4622.
`InstId` cannot be poisoned since carbon-language#4764. Part of carbon-language#4622.
…istent (#4987) This is also following #4900 (comment), which points that name poisoning tests are not in the correct place. Part of #4622.
Followup of carbon-language#4987. Part of carbon-language#4622.
Followup of carbon-language#4987. Part of carbon-language#4622.
…e/name_poisoning.carbon` and move `interface` tests there Part of carbon-language#4622.
This class is not intended to be copied. Part of carbon-language#4622.
This class is not intended to be copied. Part of #4622.
…e/name_poisoning.carbon` and move `interface` tests there (#5031) See #4950 (comment). Part of #4622.
This adds missing coverage. Part of #4622.
Follow up of previous PR discussions: * https://github.com/carbon-language/carbon-lang/pull/4950/files/89c2e66dc3190159e2f8d94c31bff31bdd0d81a1..a1650a7d73c8f4013b4b77e4d7d60933f1f6d676#r1972257889 * https://github.com/carbon-language/carbon-lang/pull/4987/files#r1964105413 Part of carbon-language#4622.
Follow up of previous PR discussions ([#4950](https://github.com/carbon-language/carbon-lang/pull/4950/files/89c2e66dc3190159e2f8d94c31bff31bdd0d81a1..a1650a7d73c8f4013b4b77e4d7d60933f1f6d676#r1972257889), [#4987](https://github.com/carbon-language/carbon-lang/pull/4987/files#r1964105413)). Part of #4622.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the This issue is labeled |
… triggering location This will allow us to provide better diagnostics. `Destroy` is a special case (in `LookupMemberNameInScope()`) because we only add it if lookup is fails finding the name. Part of carbon-language#4622.
Unassigning myself since diagnostic quality is not a priority right now, in case someone would like to look into the improvements necessary here. |
Uh oh!
There was an error while loading. Please reload this page.
The text was updated successfully, but these errors were encountered: