Skip to content

[NFC] Use LookupTypeResult's public API #30360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/Sema/TypeCheckNameLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
// Add the type to the result set, so that we can diagnose the
// reference instead of just saying the member does not exist.
if (types.insert(memberType->getCanonicalType()).second)
result.Results.push_back({typeDecl, memberType, nullptr});
result.addResult({typeDecl, memberType, nullptr});

continue;
}
Expand Down Expand Up @@ -475,10 +475,10 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,

// If we haven't seen this type result yet, add it to the result set.
if (types.insert(memberType->getCanonicalType()).second)
result.Results.push_back({typeDecl, memberType, nullptr});
result.addResult({typeDecl, memberType, nullptr});
}

if (result.Results.empty()) {
if (!result) {
// We couldn't find any normal declarations. Let's try inferring
// associated types.
ConformanceCheckOptions conformanceOptions;
Expand Down Expand Up @@ -517,7 +517,7 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
auto memberType =
substMemberTypeWithBase(dc->getParentModule(), typeDecl, type);
if (types.insert(memberType->getCanonicalType()).second)
result.Results.push_back({typeDecl, memberType, assocType});
result.addResult({typeDecl, memberType, assocType});
}
}

Expand Down
2 changes: 0 additions & 2 deletions lib/Sema/TypeChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class LookupTypeResult {
/// The set of results found.
SmallVector<LookupTypeResultEntry, 4> Results;

friend class TypeChecker;

public:
using iterator = SmallVectorImpl<LookupTypeResultEntry>::iterator;
iterator begin() { return Results.begin(); }
Expand Down