Sema: Replace calls to OverloadChoice constructor with two overloads of getDecl()

This commit is contained in:
Slava Pestov
2025-09-17 12:02:46 -04:00
parent b181fcf0fd
commit a12c160d0b
5 changed files with 49 additions and 29 deletions

View File

@@ -10491,8 +10491,8 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
auto choice =
instanceTy->isAnyObject()
? candidate
: OverloadChoice(instanceTy, decl,
FunctionRefInfo::singleBaseNameApply());
: OverloadChoice::getDecl(instanceTy, decl,
FunctionRefInfo::singleBaseNameApply());
const bool invalidMethodRef = isa<FuncDecl>(decl) && !hasInstanceMethods;
const bool invalidMemberRef = !isa<FuncDecl>(decl) && !hasInstanceMembers;
@@ -10727,7 +10727,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
}
}
return OverloadChoice(baseTy, cand, functionRefInfo);
return OverloadChoice::getDecl(baseTy, cand, functionRefInfo);
};
// Add all results from this lookup.
@@ -11866,7 +11866,8 @@ ConstraintSystem::simplifyValueWitnessConstraint(
if (!witness)
return fail();
auto choice = OverloadChoice(resolvedBaseType, witness.getDecl(), functionRefInfo);
auto choice = OverloadChoice::getDecl(
resolvedBaseType, witness.getDecl(), functionRefInfo);
addBindOverloadConstraint(memberType, choice, getConstraintLocator(locator),
useDC);
return SolutionKind::Solved;
@@ -14110,8 +14111,8 @@ ConstraintSystem::simplifyDynamicCallableApplicableFnConstraint(
SmallVector<OverloadChoice, 4> choices;
for (auto candidate : candidates) {
if (candidate->isInvalid()) continue;
choices.push_back(OverloadChoice(type2, candidate,
FunctionRefInfo::singleBaseNameApply()));
choices.push_back(OverloadChoice::getDecl(type2, candidate,
FunctionRefInfo::singleBaseNameApply()));
}
if (choices.empty()) {