-
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
Perform member lookup on FacetAccessType #5058
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,6 +234,19 @@ auto AppendLookupScopesForConstant(Context& context, SemIR::LocId loc_id, | |
-> bool { | ||
auto base_id = context.constant_values().GetInstId(base_const_id); | ||
auto base = context.insts().Get(base_id); | ||
|
||
if (auto base_as_facet_access_type = base.TryAs<SemIR::FacetAccessType>()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't have to be this PR, but this is starting to look like a common operation (#5060 should possibly also do this) that I wonder if it could be moved into its own function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue with moving it to another function is that in both cases we are also overwriting/replacing a few other derived variables, like here the Maybe we could unconditionally get the constant value and return that inst and its type as a pair or something? I'm not sure - let's leave it out of this PR at least |
||
// Move from the symbolic facet value up in typish-ness to its FacetType to | ||
// find a lookup scope. | ||
auto facet_type_type_id = | ||
context.insts() | ||
.Get(base_as_facet_access_type->facet_value_inst_id) | ||
.type_id(); | ||
base_const_id = context.types().GetConstantId(facet_type_type_id); | ||
base_id = context.constant_values().GetInstId(base_const_id); | ||
base = context.insts().Get(base_id); | ||
} | ||
|
||
if (auto base_as_namespace = base.TryAs<SemIR::Namespace>()) { | ||
scopes->push_back( | ||
LookupScope{.name_scope_id = base_as_namespace->name_scope_id, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm expecting this wasn't meant to be left in the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh argh no, this was giving me a place to breakpoint. Removing