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

[NFC] In DeclNameStack::AddName(), use NameScope::AddRequired() instead of duplicating its logic #4610

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

bricknerb
Copy link
Contributor

This is a pure code deduplication change.

@github-actions github-actions bot requested a review from jonmeow December 2, 2024 11:00
name_context.unresolved_name_id, add_scope);
CARBON_CHECK(
result.is_inserted(),
"Duplicate names should have been resolved previously: {0} in {1}",
Copy link
Contributor

@danakj danakj Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to approve, but I see the diagnostic is changed.
The diagnostic on duplicate entry before:
"Duplicate names should have been resolved previously: {unresolved_name_id} in {parent_scope_id}"
The diagnostic on duplicate now:
"Failed to add required name: {unresolved_name_id}"

Maybe that's fine, or maybe we should pass in the parent scope id, not sure so I'll let someone else review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is a crash diagnostic, so not expected to occur unless there's a bug in the compiler logic.

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.

Thanks!

@jonmeow jonmeow enabled auto-merge December 2, 2024 19:59
@jonmeow jonmeow added this pull request to the merge queue Dec 2, 2024
Merged via the queue into carbon-language:trunk with commit a297eef Dec 2, 2024
10 checks passed
@bricknerb bricknerb deleted the scope branch December 3, 2024 11:16
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