Replace GetTypeInSpecific with GetTypeOfInstInSpecific. (#5232)

Reduce usage of `GetConstantInSpecific` to a single caller in constant
evaluation, with a TODO to remove that.

This gets us closer to being able to fully perform type-checking against
abstract types instead of types anchored within a particular generic.
This commit is contained in:
Richard Smith
2025-04-02 22:52:11 +00:00
committed by GitHub
parent 077cf56a8a
commit c33adfafd3
12 changed files with 132 additions and 105 deletions
+5 -4
View File
@@ -261,10 +261,11 @@ static auto LookupMemberNameInScope(Context& context, SemIR::LocId loc_id,
}
// TODO: This duplicates the work that HandleNameAsExpr does. Factor this out.
auto inst = context.insts().Get(result.scope_result.target_inst_id());
auto type_id = SemIR::GetTypeInSpecific(context.sem_ir(), result.specific_id,
inst.type_id());
CARBON_CHECK(type_id.has_value(), "Missing type for member {0}", inst);
auto type_id =
SemIR::GetTypeOfInstInSpecific(context.sem_ir(), result.specific_id,
result.scope_result.target_inst_id());
CARBON_CHECK(type_id.has_value(), "Missing type for member {0}",
context.insts().Get(result.scope_result.target_inst_id()));
// If the named entity has a constant value that depends on its specific,
// store the specific too.