Change ImplWitnessTablePlaceholder from instruction to InstId value (#6294)

`ImplWitnessTablePlaceholder` is the only non-type singleton instruction
(`ErrorInst` is a type; while `ImplWitnessTablePlaceholder` exposes
`TypeInstId`, it's only used as an `InstId`).

In order to allow simpler handling of singleton instructions, replace
`ImplWitnessTablePlaceholder::TypeInstId` uses with
`InstId::ImplWitnessTablePlaceholder`. Since the placeholder instruction
was never evaluated, this has no significant effect on behavior.

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
Jon Ross-Perkins
2025-10-29 18:10:24 +00:00
committed by GitHub
co-authored by Dana Jansens
parent 93dc369ebd
commit a1fd86cf27
19 changed files with 2094 additions and 2115 deletions
+2 -2
View File
@@ -141,7 +141,7 @@ auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void {
CARBON_CHECK(decl_id.has_value(), "Non-constant associated entity");
if (auto decl =
context.insts().TryGetAs<SemIR::AssociatedConstantDecl>(decl_id)) {
if (witness_value == SemIR::ImplWitnessTablePlaceholder::TypeInstId) {
if (witness_value == SemIR::InstId::ImplWitnessTablePlaceholder) {
CARBON_DIAGNOSTIC(ImplAssociatedConstantNeedsValue, Error,
"associated constant {0} not given a value in impl "
"of interface {1}",
@@ -252,7 +252,7 @@ auto FillImplWitnessWithErrors(Context& context, SemIR::Impl& impl) -> void {
auto witness_block =
context.inst_blocks().GetMutable(witness_table.elements_id);
for (auto& elem : witness_block) {
if (elem == SemIR::ImplWitnessTablePlaceholder::TypeInstId) {
if (elem == SemIR::InstId::ImplWitnessTablePlaceholder) {
elem = SemIR::ErrorInst::InstId;
}
}