Eliminate the 'Module' variant from UnqualifiedLookupResult.

Make unqualified lookup always provide a declaration for the things it
finds, rather than providing either a module or a declaration. Unify
various code paths in our type checker now that module declarations
come in with the other declarations.

Swift SVN r28286
This commit is contained in:
Doug Gregor
2015-05-07 21:10:55 +00:00
parent 2653a6569b
commit edbb75eef8
13 changed files with 147 additions and 245 deletions

View File

@@ -1330,24 +1330,22 @@ public:
UnqualifiedLookup lookup(ctx.getIdentifier(Tok.getText()),
&REPLInputFile, nullptr);
for (auto result : lookup.Results) {
if (result.hasValueDecl()) {
printOrDumpDecl(result.getValueDecl(), doPrint);
printOrDumpDecl(result.getValueDecl(), doPrint);
if (auto typeDecl = dyn_cast<TypeDecl>(result.getValueDecl())) {
if (auto typeAliasDecl = dyn_cast<TypeAliasDecl>(typeDecl)) {
TypeDecl *origTypeDecl = typeAliasDecl->getUnderlyingType()
->getNominalOrBoundGenericNominal();
if (origTypeDecl) {
printOrDumpDecl(origTypeDecl, doPrint);
typeDecl = origTypeDecl;
}
if (auto typeDecl = dyn_cast<TypeDecl>(result.getValueDecl())) {
if (auto typeAliasDecl = dyn_cast<TypeAliasDecl>(typeDecl)) {
TypeDecl *origTypeDecl = typeAliasDecl->getUnderlyingType()
->getNominalOrBoundGenericNominal();
if (origTypeDecl) {
printOrDumpDecl(origTypeDecl, doPrint);
typeDecl = origTypeDecl;
}
}
// Print extensions.
if (auto nominal = dyn_cast<NominalTypeDecl>(typeDecl)) {
for (auto extension : nominal->getExtensions()) {
printOrDumpDecl(extension, doPrint);
}
// Print extensions.
if (auto nominal = dyn_cast<NominalTypeDecl>(typeDecl)) {
for (auto extension : nominal->getExtensions()) {
printOrDumpDecl(extension, doPrint);
}
}
}