Просмотр исходного кода

Use the new IsFacetTypeOrError function (#6438)

It is introduced in #6434
Dana Jansens 5 месяцев назад
Родитель
Сommit
e5c94b193d
2 измененных файлов с 2 добавлено и 4 удалено
  1. 1 2
      toolchain/check/handle_where.cpp
  2. 1 2
      toolchain/sem_ir/type_iterator.h

+ 1 - 2
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);

+ 1 - 2
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);