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
+4 -4
View File
@@ -109,10 +109,10 @@ static auto HandleNameAsExpr(Context& context, Parse::NodeId node_id,
SemIR::NameId name_id) -> SemIR::InstId {
auto result = LookupUnqualifiedName(context, node_id, name_id);
SemIR::InstId inst_id = result.scope_result.target_inst_id();
auto value = context.insts().Get(inst_id);
auto type_id = SemIR::GetTypeInSpecific(context.sem_ir(), result.specific_id,
value.type_id());
CARBON_CHECK(type_id.has_value(), "Missing type for {0}", value);
auto type_id = SemIR::GetTypeOfInstInSpecific(context.sem_ir(),
result.specific_id, inst_id);
CARBON_CHECK(type_id.has_value(), "Missing type for {0}",
context.insts().Get(inst_id));
// If the named entity has a constant value that depends on its specific,
// store the specific too.