File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,12 @@ Expr *FailureDiagnostic::getBaseExprFor(Expr *anchor) const {
121
121
return SE->getBase ();
122
122
else if (auto *MRE = dyn_cast<MemberRefExpr>(anchor))
123
123
return MRE->getBase ();
124
+ else if (auto *call = dyn_cast<CallExpr>(anchor)) {
125
+ auto fnType = getType (call->getFn ());
126
+ if (fnType->isCallableNominalType (getDC ())) {
127
+ return call->getFn ();
128
+ }
129
+ }
124
130
125
131
return nullptr ;
126
132
}
Original file line number Diff line number Diff line change @@ -102,9 +102,7 @@ struct Mutating {
102
102
}
103
103
}
104
104
func testMutating( _ x: Mutating , _ y: inout Mutating ) {
105
- // TODO(SR-11378): Improve this error to match the error using a direct `callAsFunction` member reference.
106
- // expected-error @+2 {{cannot call value of non-function type 'Mutating'}}
107
- // expected-error @+1 {{cannot invoke 'x' with no arguments}}
105
+ // expected-error @+1 {{cannot use mutating member on immutable value: 'x' is a 'let' constant}}
108
106
_ = x ( )
109
107
// expected-error @+1 {{cannot use mutating member on immutable value: 'x' is a 'let' constant}}
110
108
_ = x. callAsFunction ( )
You can’t perform that action at this time.
0 commit comments