Skip to content

Commit 000928d

Browse files
authored
Merge pull request #30360 from CodaFi/results-may-vary
2 parents d23082f + 266f3ad commit 000928d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/Sema/TypeCheckNameLookup.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
429429
// Add the type to the result set, so that we can diagnose the
430430
// reference instead of just saying the member does not exist.
431431
if (types.insert(memberType->getCanonicalType()).second)
432-
result.Results.push_back({typeDecl, memberType, nullptr});
432+
result.addResult({typeDecl, memberType, nullptr});
433433

434434
continue;
435435
}
@@ -475,10 +475,10 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
475475

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

481-
if (result.Results.empty()) {
481+
if (!result) {
482482
// We couldn't find any normal declarations. Let's try inferring
483483
// associated types.
484484
ConformanceCheckOptions conformanceOptions;
@@ -517,7 +517,7 @@ LookupTypeResult TypeChecker::lookupMemberType(DeclContext *dc,
517517
auto memberType =
518518
substMemberTypeWithBase(dc->getParentModule(), typeDecl, type);
519519
if (types.insert(memberType->getCanonicalType()).second)
520-
result.Results.push_back({typeDecl, memberType, assocType});
520+
result.addResult({typeDecl, memberType, assocType});
521521
}
522522
}
523523

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ class LookupTypeResult {
9090
/// The set of results found.
9191
SmallVector<LookupTypeResultEntry, 4> Results;
9292

93-
friend class TypeChecker;
94-
9593
public:
9694
using iterator = SmallVectorImpl<LookupTypeResultEntry>::iterator;
9795
iterator begin() { return Results.begin(); }

0 commit comments

Comments
 (0)