@@ -116,15 +116,15 @@ Optional<SelectedOverload> FailureDiagnostic::getChoiceFor(Expr *expr) {
116
116
} else if (auto *TE = dyn_cast<TypeExpr>(expr)) {
117
117
locator = cs.getConstraintLocator (call,
118
118
{ConstraintLocator::ApplyFunction,
119
- ConstraintLocator::ConstructorMember},
119
+ ConstraintLocator::ConstructorMember},
120
120
/* summaryFlags=*/ 0 );
121
121
} else if (auto *SE = dyn_cast<SubscriptExpr>(expr)) {
122
122
locator = cs.getConstraintLocator (SE, ConstraintLocator::SubscriptMember);
123
123
} else {
124
124
locator = cs.getConstraintLocator (expr);
125
125
}
126
-
127
- if (!locator)
126
+
127
+ if (!locator)
128
128
return None;
129
129
130
130
return getOverloadChoiceIfAvailable (locator);
@@ -2071,8 +2071,8 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
2071
2071
emitDiagnostic (loc, diag::super_initializer_not_in_initializer);
2072
2072
return true ;
2073
2073
}
2074
-
2075
- auto isInsideCall = [this ](Expr *expr) {
2074
+
2075
+ auto isCallArgument = [this ](Expr *expr) {
2076
2076
auto &cs = getConstraintSystem ();
2077
2077
auto argExpr = cs.getParentExpr (expr);
2078
2078
if (!argExpr)
@@ -2086,15 +2086,16 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
2086
2086
auto isImmutable = [&DC](ValueDecl *decl) {
2087
2087
if (auto *storage = dyn_cast<AbstractStorageDecl>(decl))
2088
2088
return !storage->isSettable (DC) ||
2089
- !storage->isSetterAccessibleFrom (DC);
2089
+ !storage->isSetterAccessibleFrom (DC);
2090
2090
2091
2091
return false ;
2092
2092
};
2093
-
2093
+
2094
2094
auto selection = getChoiceFor (ctorRef->getBase ());
2095
2095
if (selection) {
2096
2096
OverloadChoice choice = selection.getValue ().choice ;
2097
- if (choice.isDecl () && !isImmutable (choice.getDecl ()) && !isInsideCall (initCall) &&
2097
+ if (choice.isDecl () && !isImmutable (choice.getDecl ()) &&
2098
+ !isCallArgument (initCall) &&
2098
2099
cs.getContextualTypePurpose () == CTP_Unused) {
2099
2100
auto fixItLoc = ctorRef->getBase ()->getSourceRange ().End ;
2100
2101
emitDiagnostic (loc, diag::init_not_instance_member_use_assignment)
0 commit comments