mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user