Skip to content

Commit ad727b4

Browse files
authored
Merge pull request swiftlang#32749 from rintaro/5.3-index-rdar64636688
[5.3][Index] Fast path for getting value member
2 parents 4d144e6 + dfb5212 commit ad727b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/Sema/CSGen.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4693,6 +4693,13 @@ swift::resolveValueMember(DeclContext &DC, Type BaseTy, DeclName Name) {
46934693
if (LookupResult.ViableCandidates.empty())
46944694
return Result;
46954695

4696+
// If there's only one viable member, that is the best one.
4697+
if (LookupResult.ViableCandidates.size() == 1) {
4698+
Result.Impl->BestIdx = Result.Impl->AllDecls.size();
4699+
Result.Impl->AllDecls.push_back(LookupResult.ViableCandidates[0].getDecl());
4700+
return Result;
4701+
}
4702+
46964703
// Try to figure out the best overload.
46974704
ConstraintLocator *Locator = CS.getConstraintLocator(nullptr);
46984705
TypeVariableType *TV = CS.createTypeVariable(Locator,

0 commit comments

Comments
 (0)