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:
Chris Lattner
2012-04-19 00:43:16 +00:00
parent 35d7fc5d1d
commit 6ab877ad83

View File

@@ -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