From 51d7e6315e8ae3a9f2b046b197f788d91ae84eda Mon Sep 17 00:00:00 2001 From: Boaz Brickner Date: Tue, 28 Jan 2025 18:45:24 +0100 Subject: [PATCH] When looking up a name in a scope, propagate the lookup result when it's poisoned (#4851) Instead of creating a new poisoned result. This would allow propagating the poisoning location when we add it. Part of #4622. --- toolchain/check/context.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index dd06c1ca603e..ce45cbfd005c 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -431,9 +431,8 @@ auto Context::LookupNameInExactScope(SemIRLoc loc, SemIR::NameId name_id, auto lookup_result = scope.GetEntry(*entry_id).result; if (!lookup_result.is_poisoned()) { LoadImportRef(*this, lookup_result.target_inst_id()); - return lookup_result; } - return SemIR::ScopeLookupResult::MakePoisoned(); + return lookup_result; } if (!scope.import_ir_scopes().empty()) {