Skip to content

Commit 9e18f2a

Browse files
committed
AST: Use ResolutionKind::TypesOnly for qualified lookup too
1 parent c450b45 commit 9e18f2a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/AST/NameLookup.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,14 +1613,16 @@ bool DeclContext::lookupQualified(ModuleDecl *module, DeclName member,
16131613
bool isLookupCascading;
16141614
configureLookup(this, options, tracker, isLookupCascading);
16151615

1616+
auto kind = (options & NL_OnlyTypes
1617+
? ResolutionKind::TypesOnly
1618+
: ResolutionKind::Overloadable);
16161619
auto topLevelScope = getModuleScopeContext();
16171620
if (module == topLevelScope->getParentModule()) {
16181621
if (tracker) {
16191622
recordLookupOfTopLevelName(topLevelScope, member, isLookupCascading);
16201623
}
16211624
lookupInModule(module, /*accessPath=*/{}, member, decls,
1622-
NLKind::QualifiedLookup, ResolutionKind::Overloadable,
1623-
topLevelScope);
1625+
NLKind::QualifiedLookup, kind, topLevelScope);
16241626
} else {
16251627
// Note: This is a lookup into another module. Unless we're compiling
16261628
// multiple modules at once, or if the other module re-exports this one,
@@ -1633,8 +1635,7 @@ bool DeclContext::lookupQualified(ModuleDecl *module, DeclName member,
16331635
if (import.second != module)
16341636
return true;
16351637
lookupInModule(import.second, import.first, member, decls,
1636-
NLKind::QualifiedLookup, ResolutionKind::Overloadable,
1637-
topLevelScope);
1638+
NLKind::QualifiedLookup, kind, topLevelScope);
16381639
// If we're able to do an unscoped lookup, we see everything. No need
16391640
// to keep going.
16401641
return !import.first.empty();
@@ -1644,10 +1645,6 @@ bool DeclContext::lookupQualified(ModuleDecl *module, DeclName member,
16441645
llvm::SmallPtrSet<ValueDecl *, 4> knownDecls;
16451646
decls.erase(std::remove_if(decls.begin(), decls.end(),
16461647
[&](ValueDecl *vd) -> bool {
1647-
// If we're performing a type lookup, skip non-types.
1648-
if ((options & NL_OnlyTypes) && !isa<TypeDecl>(vd))
1649-
return true;
1650-
16511648
return !knownDecls.insert(vd).second;
16521649
}), decls.end());
16531650

0 commit comments

Comments
 (0)