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.
This commit is contained in:
Boaz Brickner
2025-01-28 17:45:24 +00:00
committed by GitHub
parent 5abe5a3c21
commit 51d7e6315e
+1 -2
View File
@@ -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()) {