Skip to content

Commit eb84f5e

Browse files
authored
Merge pull request swiftlang#32748 from rintaro/index-rdar64636688
[Index] Fast path for getting value member
2 parents 8ab0f51 + 0269049 commit eb84f5e

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
@@ -4458,6 +4458,13 @@ swift::resolveValueMember(DeclContext &DC, Type BaseTy, DeclName Name) {
44584458
if (LookupResult.ViableCandidates.empty())
44594459
return Result;
44604460

4461+
// If there's only one viable member, that is the best one.
4462+
if (LookupResult.ViableCandidates.size() == 1) {
4463+
Result.Impl->BestIdx = Result.Impl->AllDecls.size();
4464+
Result.Impl->AllDecls.push_back(LookupResult.ViableCandidates[0].getDecl());
4465+
return Result;
4466+
}
4467+
44614468
// Try to figure out the best overload.
44624469
ConstraintLocator *Locator = CS.getConstraintLocator({});
44634470
TypeVariableType *TV = CS.createTypeVariable(Locator,

0 commit comments

Comments
 (0)