Skip to content

Commit 7c01bb4

Browse files
authored
Return the NameId for a new instruction regardless if it's unresolved because it's poisoned or not (#4861)
i.e. Support `Poisoned` in `NameContext::name_id_for_new_inst()`. Part of #4622.
1 parent 3bd7252 commit 7c01bb4

File tree

3 files changed

+141
-136
lines changed

3 files changed

+141
-136
lines changed

toolchain/check/decl_name_stack.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,13 @@ class DeclNameStack {
122122
// Returns the name_id for a new instruction. This is `None` when the name
123123
// resolved.
124124
auto name_id_for_new_inst() -> SemIR::NameId {
125-
return state == State::Unresolved ? unresolved_name_id
126-
: SemIR::NameId::None;
125+
switch (state) {
126+
case State::Unresolved:
127+
case State::Poisoned:
128+
return unresolved_name_id;
129+
default:
130+
return SemIR::NameId::None;
131+
}
127132
}
128133

129134
// The current scope when this name began. This is the scope that we will

0 commit comments

Comments
 (0)