mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use hasAppliedSelf in getFunctionArgApplyInfo
`callee->hasCurriedSelf()` isn't the correct check here when we have an argument mismatch for the self parameter in a curried application.
This commit is contained in:
@@ -3043,6 +3043,22 @@ bool constraints::isAutoClosureArgument(Expr *argExpr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool constraints::hasAppliedSelf(ConstraintSystem &cs,
|
||||
const OverloadChoice &choice) {
|
||||
auto *decl = choice.getDeclOrNull();
|
||||
if (!decl)
|
||||
return false;
|
||||
|
||||
auto baseType = choice.getBaseType();
|
||||
if (baseType)
|
||||
baseType = cs.getFixedTypeRecursive(baseType, /*wantRValue=*/true);
|
||||
|
||||
// In most cases where we reference a declaration with a curried self
|
||||
// parameter, it gets dropped from the type of the reference.
|
||||
return decl->hasCurriedSelf() &&
|
||||
doesMemberRefApplyCurriedSelf(baseType, decl);
|
||||
}
|
||||
|
||||
bool constraints::conformsToKnownProtocol(ConstraintSystem &cs, Type type,
|
||||
KnownProtocolKind protocol) {
|
||||
if (auto *proto = cs.TC.getProtocol(SourceLoc(), protocol))
|
||||
|
||||
Reference in New Issue
Block a user