Skip to content

Commit 743d8fb

Browse files
committed
Sema: Change isImmutable to isMutable (thanks De Morgan) and negated call
1 parent c498f38 commit 743d8fb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,18 +2083,17 @@ bool AllowTypeOrInstanceMemberFailure::diagnoseAsError() {
20832083

20842084
auto *initCall = cs.getParentExpr(cs.getParentExpr(ctorRef));
20852085

2086-
auto isImmutable = [&DC](ValueDecl *decl) {
2086+
auto isMutable = [&DC](ValueDecl *decl) {
20872087
if (auto *storage = dyn_cast<AbstractStorageDecl>(decl))
2088-
return !storage->isSettable(DC) ||
2089-
!storage->isSetterAccessibleFrom(DC);
2088+
return storage->isSettable(DC) && storage->isSetterAccessibleFrom(DC);
20902089

2091-
return false;
2090+
return true;
20922091
};
20932092

20942093
auto selection = getChoiceFor(ctorRef->getBase());
20952094
if (selection) {
20962095
OverloadChoice choice = selection.getValue().choice;
2097-
if (choice.isDecl() && !isImmutable(choice.getDecl()) &&
2096+
if (choice.isDecl() && isMutable(choice.getDecl()) &&
20982097
!isCallArgument(initCall) &&
20992098
cs.getContextualTypePurpose() == CTP_Unused) {
21002099
auto fixItLoc = ctorRef->getBase()->getSourceRange().End;

0 commit comments

Comments
 (0)