Formatter: don't crash on unexpected SemIR. (#6787)

The formatter is used as a debugging tool, so shouldn't crash if the
SemIR is in an unexpected shape.
This commit is contained in:
Richard Smith
2026-02-27 01:02:53 +00:00
committed by GitHub
parent b83dcd4348
commit be88dfd744
+3 -1
View File
@@ -733,7 +733,9 @@ auto Formatter::FormatParamList(InstBlockId params_id, InstId return_form_id)
out() << "invalid";
continue;
}
CARBON_CHECK(!sem_ir_->insts().Is<OutParam>(param_id));
if (sem_ir_->insts().Is<OutParam>(param_id)) {
out() << "<unexpected out> ";
}
FormatNameAndForm(param_id, sem_ir_->insts().Get(param_id));
}