mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 22:02:42 +01:00
Tolerate incomplete interface when stringifying ImplWitnessAccess (#5730)
Closes #5727
This commit is contained in:
@@ -420,10 +420,15 @@ class Stringifier {
|
||||
auto StringifyInst(InstId /*inst_id*/, ImplWitnessAccess inst) -> void {
|
||||
auto witness_inst_id =
|
||||
sem_ir_->constant_values().GetConstantInstId(inst.witness_id);
|
||||
if (auto specific_interface =
|
||||
TryGetSpecificInterfaceForImplWitness(witness_inst_id)) {
|
||||
const auto& interface =
|
||||
sem_ir_->interfaces().Get(specific_interface->interface_id);
|
||||
auto lookup = sem_ir_->insts().GetAs<LookupImplWitness>(witness_inst_id);
|
||||
auto specific_interface =
|
||||
sem_ir_->specific_interfaces().Get(lookup.query_specific_interface_id);
|
||||
const auto& interface =
|
||||
sem_ir_->interfaces().Get(specific_interface.interface_id);
|
||||
if (!interface.associated_entities_id.has_value()) {
|
||||
step_stack_->Push(".(TODO: element ", inst.index, " in incomplete ",
|
||||
witness_inst_id, ")");
|
||||
} else {
|
||||
auto entities =
|
||||
sem_ir_->inst_blocks().Get(interface.associated_entities_id);
|
||||
size_t index = inst.index.index;
|
||||
@@ -446,11 +451,8 @@ class Stringifier {
|
||||
}
|
||||
step_stack_->Push(
|
||||
".(",
|
||||
StepStack::EntityNameItem{interface, specific_interface->specific_id},
|
||||
StepStack::EntityNameItem{interface, specific_interface.specific_id},
|
||||
".");
|
||||
} else {
|
||||
step_stack_->Push(".(TODO: element ", inst.index, " in ", witness_inst_id,
|
||||
")");
|
||||
}
|
||||
|
||||
if (auto lookup =
|
||||
|
||||
Reference in New Issue
Block a user