Skip to content

Commit 0aeaf7f

Browse files
committed
[Diagnostics] NFC: Remove "trailing" from method name for closures with missing args
`MissingArgumentsFailure::diagnoseClosure` can actually diagnose both closures in argument positions as well as when their type comes from context e.g. `let _: (Int) -> Void = {}`.
1 parent 4d02463 commit 0aeaf7f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,12 +3509,12 @@ bool MissingArgumentsFailure::diagnoseAsError() {
35093509
anchor = captureList->getClosureBody();
35103510

35113511
if (auto *closure = dyn_cast<ClosureExpr>(anchor))
3512-
return diagnoseTrailingClosure(closure);
3512+
return diagnoseClosure(closure);
35133513

35143514
return false;
35153515
}
35163516

3517-
bool MissingArgumentsFailure::diagnoseTrailingClosure(ClosureExpr *closure) {
3517+
bool MissingArgumentsFailure::diagnoseClosure(ClosureExpr *closure) {
35183518
auto &cs = getConstraintSystem();
35193519
FunctionType *funcType = nullptr;
35203520

lib/Sema/CSDiagnostics.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,9 +1192,9 @@ class MissingArgumentsFailure final : public FailureDiagnostic {
11921192
bool diagnoseAsError() override;
11931193

11941194
private:
1195-
/// If missing arguments come from trailing closure,
1195+
/// If missing arguments come from a closure,
11961196
/// let's produce tailored diagnostics.
1197-
bool diagnoseTrailingClosure(ClosureExpr *closure);
1197+
bool diagnoseClosure(ClosureExpr *closure);
11981198
};
11991199

12001200
class OutOfOrderArgumentFailure final : public FailureDiagnostic {

0 commit comments

Comments
 (0)