diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index a3ee68432c97..9a7506b7175d 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -210,7 +210,7 @@ auto Context::ResolveIfLazyImportRef(SemIR::InstId inst_id) -> void { auto Context::LookupNameInDecl(Parse::NodeId /*parse_node*/, SemIR::NameId name_id, SemIR::NameScopeId scope_id) -> SemIR::InstId { - if (scope_id == SemIR::NameScopeId::Invalid) { + if (!scope_id.is_valid()) { // Look for a name in the current scope only. There are two cases where the // name would be in an outer scope: // diff --git a/toolchain/check/decl_name_stack.cpp b/toolchain/check/decl_name_stack.cpp index 1b5fce8df075..74639bda3124 100644 --- a/toolchain/check/decl_name_stack.cpp +++ b/toolchain/check/decl_name_stack.cpp @@ -66,7 +66,7 @@ auto DeclNameStack::LookupOrAddName(NameContext name_context, return name_context.resolved_inst_id; case NameContext::State::Unresolved: - if (name_context.target_scope_id == SemIR::NameScopeId::Invalid) { + if (!name_context.target_scope_id.is_valid()) { context_->AddNameToLookup(name_context.parse_node, name_context.unresolved_name_id, target_id); } else { diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index 871ce27ffc74..381e5d1242e0 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -338,7 +338,7 @@ class InstNamer { return; } - if (parse_node == Parse::NodeId::Invalid) { + if (!parse_node.is_valid()) { if (const auto& block = sem_ir_.inst_blocks().Get(block_id); !block.empty()) { parse_node = sem_ir_.insts().Get(block.front()).parse_node(); diff --git a/toolchain/sem_ir/value_stores.h b/toolchain/sem_ir/value_stores.h index 479e6a6b912e..019e1d145fce 100644 --- a/toolchain/sem_ir/value_stores.h +++ b/toolchain/sem_ir/value_stores.h @@ -77,7 +77,7 @@ class TypeStore : public ValueStore { return InstId::BuiltinTypeType; } else if (type_id == TypeId::Error) { return InstId::BuiltinError; - } else if (type_id == TypeId::Invalid) { + } else if (!type_id.is_valid()) { return InstId::Invalid; } else { return Get(type_id).inst_id;