Skip to content

Commit 2507c55

Browse files
authored
Fix assumptions about ImportRefUnused in lexical lookups (#3784)
I'd added these trying to catch cases where ImportRefUnused might be returned, but I believe these are incorrect. Mistakes should still be caught because an ImportRefUnused will lead to errors in other handling. Removing the TryResolveImportRefUnused should clarify the semantics of when an ImportRefUnused is expected.
1 parent 8567e02 commit 2507c55

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

toolchain/check/context.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,7 @@ auto Context::LookupNameInDecl(Parse::NodeId /*node_id*/, SemIR::NameId name_id,
216216
// In this case, we're not in the correct scope to define a member of
217217
// class A, so we should reject, and we achieve this by not finding the
218218
// name A from the outer scope.
219-
auto result = scope_stack().LookupInCurrentScope(name_id);
220-
if (result.is_valid()) {
221-
TryResolveImportRefUnused(*this, result);
222-
}
223-
return result;
219+
return scope_stack().LookupInCurrentScope(name_id);
224220
} else {
225221
// We do not look into `extend`ed scopes here. A qualified name in a
226222
// declaration must specify the exact scope in which the name was originally
@@ -255,7 +251,6 @@ auto Context::LookupUnqualifiedName(Parse::NodeId node_id,
255251
}
256252

257253
if (lexical_result.is_valid()) {
258-
TryResolveImportRefUnused(*this, lexical_result);
259254
return lexical_result;
260255
}
261256

0 commit comments

Comments
 (0)