diff --git a/toolchain/sem_ir/inst_namer.cpp b/toolchain/sem_ir/inst_namer.cpp index 271bed5eb152e..04aa2a63f6aa3 100644 --- a/toolchain/sem_ir/inst_namer.cpp +++ b/toolchain/sem_ir/inst_namer.cpp @@ -129,30 +129,39 @@ auto InstNamer::GetScopeIdOffset(ScopeIdTypeEnum id_enum) const -> int { switch (id_enum) { case ScopeIdTypeEnum::None: // `None` will be getting a full count of scopes. + offset += sem_ir_->associated_constants().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->classes().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->cpp_overload_sets().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->functions().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->impls().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->interfaces().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->specific_interfaces().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + offset += sem_ir_->vtables().size(); [[fallthrough]]; case ScopeIdTypeEnum::For: + // All type-specific scopes are offset by `FirstEntityScope`. offset += static_cast(ScopeId::FirstEntityScope); return offset;