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

Add some comments in check that required some reverse engineering #4780

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

Conversation

danakj
Copy link
Contributor

@danakj danakj commented Jan 9, 2025

While reading check I had to figure some things out that were not trivial, and I saved them with comments.

@danakj
Copy link
Contributor Author

danakj commented Jan 9, 2025

Hopefully these make sense, I had saved these in a branch a while ago, and thought I should do something with them.

While reading check I had to figure some things out that were not
trivial, and I saved them with comments.
Copy link
Contributor

@geoffromer geoffromer left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I'm not familiar with the code in question, so it'd probably be good for Jon to verify that these comments capture the intent.

toolchain/check/context.h Outdated Show resolved Hide resolved
Co-authored-by: Jon Ross-Perkins <[email protected]>
@danakj danakj requested a review from jonmeow January 9, 2025 18:33
@@ -31,6 +31,8 @@ struct PackageImports {
: package_id(package_id), node_id(node_id) {}

// The identifier of the imported package.
//
// The current package uses the `IdentifierId::Invalid` id.
Copy link
Contributor

@jonmeow jonmeow Jan 9, 2025

Choose a reason for hiding this comment

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

This semantic isn't specific to CheckUnit. It's in check.cpp, PackagingNames, SemIR::File, etc. I don't think it makes sense to start documenting separately in every place. Maybe it'd be better to find a central way to document this? You could probably add an alias if you prefer (or, PackagingNames is what it all stems from, so it could just be commented there).

Copy link
Contributor

Choose a reason for hiding this comment

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

To be sure, with an alias, I'm thinking something like a documenting IdentifierId::DefaultPackage or something. But we already have LibraryNameId, so another option would be to add a similar PackageIdentifierId type.

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