@@ -106,18 +106,18 @@ Optional<SelectedOverload> FailureDiagnostic::getChoiceFor(Expr *expr) {
106
106
auto &cs = getConstraintSystem ();
107
107
ConstraintLocator *locator = nullptr ;
108
108
109
- if (auto *call = dyn_cast<CallExpr>(expr)) {
110
- auto *fnExpr = call->getFn ();
111
- return getChoiceFor (fnExpr);
109
+ if (auto *AE = dyn_cast<ApplyExpr>(expr)) {
110
+ if (auto *TE = dyn_cast<TypeExpr>(AE->getFn ())) {
111
+ locator = cs.getConstraintLocator (AE,
112
+ {ConstraintLocator::ApplyFunction,
113
+ ConstraintLocator::ConstructorMember},
114
+ /* summaryFlags=*/ 0 );
115
+ }
116
+ return getChoiceFor (AE->getFn ());
112
117
} else if (auto *UDE = dyn_cast<UnresolvedDotExpr>(expr)) {
113
118
locator = cs.getConstraintLocator (UDE, ConstraintLocator::Member);
114
119
} else if (auto *UME = dyn_cast<UnresolvedMemberExpr>(expr)) {
115
120
locator = cs.getConstraintLocator (UME, ConstraintLocator::UnresolvedMember);
116
- } else if (auto *TE = dyn_cast<TypeExpr>(expr)) {
117
- locator = cs.getConstraintLocator (call,
118
- {ConstraintLocator::ApplyFunction,
119
- ConstraintLocator::ConstructorMember},
120
- /* summaryFlags=*/ 0 );
121
121
} else if (auto *SE = dyn_cast<SubscriptExpr>(expr)) {
122
122
locator = cs.getConstraintLocator (SE, ConstraintLocator::SubscriptMember);
123
123
} else {
@@ -2077,8 +2077,8 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
2077
2077
auto argExpr = cs.getParentExpr (expr);
2078
2078
if (!argExpr)
2079
2079
return false ;
2080
- auto possibleCallExpr = cs.getParentExpr (expr);
2081
- return possibleCallExpr && isa<CallExpr>(possibleCallExpr );
2080
+ auto possibleApplyExpr = cs.getParentExpr (expr);
2081
+ return possibleApplyExpr && isa<ApplyExpr>(possibleApplyExpr );
2082
2082
};
2083
2083
2084
2084
auto *initCall = cs.getParentExpr (cs.getParentExpr (ctorRef));
@@ -2092,7 +2092,7 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
2092
2092
2093
2093
auto selection = getChoiceFor (ctorRef->getBase ());
2094
2094
if (selection) {
2095
- OverloadChoice choice = selection. getValue (). choice ;
2095
+ OverloadChoice choice = selection-> choice ;
2096
2096
if (choice.isDecl () && isMutable (choice.getDecl ()) &&
2097
2097
!isCallArgument (initCall) &&
2098
2098
cs.getContextualTypePurpose () == CTP_Unused) {
0 commit comments