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
+6 -4
View File
@@ -92,10 +92,12 @@ auto GetConstantValueInSpecific(const File& sem_ir, SpecificId specific_id,
sem_ir.constant_values().Get(inst_id));
}
auto GetTypeInSpecific(const File& sem_ir, SpecificId specific_id,
TypeId type_id) -> TypeId {
return TypeId::ForTypeConstant(GetConstantInSpecific(
sem_ir, specific_id, sem_ir.types().GetConstantId(type_id)));
auto GetTypeOfInstInSpecific(const File& sem_ir, SpecificId specific_id,
InstId inst_id) -> TypeId {
auto type_id = sem_ir.insts().Get(inst_id).type_id();
auto const_id = sem_ir.types().GetConstantId(type_id);
auto specific_const_id = GetConstantInSpecific(sem_ir, specific_id, const_id);
return TypeId::ForTypeConstant(specific_const_id);
}
} // namespace Carbon::SemIR