diff --git a/toolchain/check/handle_where.cpp b/toolchain/check/handle_where.cpp index add04afd7cf19..071df8c902665 100644 --- a/toolchain/check/handle_where.cpp +++ b/toolchain/check/handle_where.cpp @@ -24,8 +24,7 @@ auto HandleParseNode(Context& context, Parse::WhereOperandId node_id) -> bool { auto self_with_constraints_type_id = ExprAsType(context, self_node, self_id).type_id; // Only facet types may have `where` restrictions. - if (self_with_constraints_type_id != SemIR::ErrorInst::TypeId && - !context.types().IsFacetType(self_with_constraints_type_id)) { + if (!context.types().IsFacetTypeOrError(self_with_constraints_type_id)) { CARBON_DIAGNOSTIC(WhereOnNonFacetType, Error, "left argument of `where` operator must be a facet type"); context.emitter().Emit(self_node, WhereOnNonFacetType); diff --git a/toolchain/sem_ir/type_iterator.h b/toolchain/sem_ir/type_iterator.h index 64ca63bf813a5..4c47f99b42f53 100644 --- a/toolchain/sem_ir/type_iterator.h +++ b/toolchain/sem_ir/type_iterator.h @@ -40,8 +40,7 @@ class TypeIterator { // The iterator will visit things in the reverse order that they are added. auto Add(InstId inst_id) -> void { auto type_id = sem_ir_->insts().Get(inst_id).type_id(); - CARBON_CHECK(sem_ir_->types().IsFacetType(type_id) || - type_id == SemIR::ErrorInst::TypeId, + CARBON_CHECK(sem_ir_->types().IsFacetTypeOrError(type_id), "Type {0} of type inst is not a facet type", sem_ir_->types().GetAsInst(type_id).kind()); PushInstId(inst_id);