Skip to content

Commit c498f38

Browse files
committed
Sema: Changed name of isInsideCall to isCallArgument and formatted changes
1 parent 85051c5 commit c498f38

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ Optional<SelectedOverload> FailureDiagnostic::getChoiceFor(Expr *expr) {
116116
} else if (auto *TE = dyn_cast<TypeExpr>(expr)) {
117117
locator = cs.getConstraintLocator(call,
118118
{ConstraintLocator::ApplyFunction,
119-
ConstraintLocator::ConstructorMember},
119+
ConstraintLocator::ConstructorMember},
120120
/*summaryFlags=*/0);
121121
} else if (auto *SE = dyn_cast<SubscriptExpr>(expr)) {
122122
locator = cs.getConstraintLocator(SE, ConstraintLocator::SubscriptMember);
123123
} else {
124124
locator = cs.getConstraintLocator(expr);
125125
}
126-
127-
if(!locator)
126+
127+
if (!locator)
128128
return None;
129129

130130
return getOverloadChoiceIfAvailable(locator);
@@ -2071,8 +2071,8 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
20712071
emitDiagnostic(loc, diag::super_initializer_not_in_initializer);
20722072
return true;
20732073
}
2074-
2075-
auto isInsideCall = [this](Expr *expr) {
2074+
2075+
auto isCallArgument = [this](Expr *expr) {
20762076
auto &cs = getConstraintSystem();
20772077
auto argExpr = cs.getParentExpr(expr);
20782078
if (!argExpr)
@@ -2086,15 +2086,16 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
20862086
auto isImmutable = [&DC](ValueDecl *decl) {
20872087
if (auto *storage = dyn_cast<AbstractStorageDecl>(decl))
20882088
return !storage->isSettable(DC) ||
2089-
!storage->isSetterAccessibleFrom(DC);
2089+
!storage->isSetterAccessibleFrom(DC);
20902090

20912091
return false;
20922092
};
2093-
2093+
20942094
auto selection = getChoiceFor(ctorRef->getBase());
20952095
if (selection) {
20962096
OverloadChoice choice = selection.getValue().choice;
2097-
if (choice.isDecl() && !isImmutable(choice.getDecl()) && !isInsideCall(initCall) &&
2097+
if (choice.isDecl() && !isImmutable(choice.getDecl()) &&
2098+
!isCallArgument(initCall) &&
20982099
cs.getContextualTypePurpose() == CTP_Unused) {
20992100
auto fixItLoc = ctorRef->getBase()->getSourceRange().End;
21002101
emitDiagnostic(loc, diag::init_not_instance_member_use_assignment)

lib/Sema/CSDiagnostics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class FailureDiagnostic {
154154
/// \returns An argument expression if given anchor is a call, member
155155
/// reference or subscript, nullptr otherwise.
156156
Expr *getArgumentExprFor(Expr *anchor) const;
157-
157+
158158
Optional<SelectedOverload> getChoiceFor(Expr *);
159159

160160
private:

0 commit comments

Comments
 (0)