mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
fix name lookup to search through all modules to build the candidate set, instead of stopping with the first module that matches. Without this, we don't get the unified overload set for all "+" operators, for example. We arguably should stop searching when we get a type (since they cannot be overloaded) but we can treat that as a follow on issue.
Swift SVN r1481
This commit is contained in:
@@ -309,16 +309,14 @@ void Module::lookupGlobalValue(Identifier Name, NLKind LookupKind,
|
||||
|
||||
// If we get any hits, we're done. Also, the builtin module never has
|
||||
// imports, so it is always done at this point.
|
||||
if (!Result.empty() || isa<BuiltinModule>(this)) return;
|
||||
if (isa<BuiltinModule>(this)) return;
|
||||
|
||||
TranslationUnit &TU = *cast<TranslationUnit>(this);
|
||||
|
||||
// If we still haven't found it, scrape through all of the imports, taking the
|
||||
// first match of the name.
|
||||
for (auto &ImpEntry : TU.getImportedModules()) {
|
||||
for (auto &ImpEntry : TU.getImportedModules())
|
||||
ImpEntry.second->lookupValue(ImpEntry.first, Name, LookupKind, Result);
|
||||
if (!Result.empty()) return; // If we found a match, return the decls.
|
||||
}
|
||||
}
|
||||
|
||||
/// lookupGlobalExtensionMethods - Lookup the extensions members for the
|
||||
|
||||
Reference in New Issue
Block a user