[ConstraintSystem] Use getNumApplications + ValueDecl::getNumCurryLevels to detect partial applications

We used to detect partial applications based on member locators
and parent expressions, but using function reference kind +
check to see if self is applied is such simpler and hits both
uses of `isPartialApplication`.
This commit is contained in:
Pavel Yaskevich
2024-08-30 15:27:33 -07:00
parent be0bf46657
commit 05b0adac5d
4 changed files with 31 additions and 13 deletions

View File

@@ -1655,8 +1655,8 @@ static unsigned getNumRemovedArgumentLabels(ValueDecl *decl,
}
/// Determine the number of applications
static unsigned getNumApplications(
ValueDecl *decl, bool hasAppliedSelf, FunctionRefKind functionRefKind) {
unsigned constraints::getNumApplications(ValueDecl *decl, bool hasAppliedSelf,
FunctionRefKind functionRefKind) {
switch (functionRefKind) {
case FunctionRefKind::Unapplied:
case FunctionRefKind::Compound:
@@ -1774,7 +1774,7 @@ FunctionType *ConstraintSystem::adjustFunctionTypeForConcurrency(
adjustedTy =
adjustedTy->withExtInfo(adjustedTy->getExtInfo().withSendable());
}
} else if (isPartialApplication(getConstraintLocator(locator))) {
} else if (numApplies < decl->getNumCurryLevels()) {
// Operators on protocols could be found via unqualified lookup and
// won't have a base type.
if (decl->isOperator() ||