Skip to content

Commit 493ad7c

Browse files
committed
[Diagnostics] NFC: Re-phrase reference to unused closure parameter in extraneous arguments diagnostic
1 parent 7ce8a44 commit 493ad7c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4984,13 +4984,14 @@ bool ExtraneousArgumentsFailure::diagnoseAsError() {
49844984
params->getStartLoc(), diag::closure_argument_list_tuple, fnType,
49854985
fnType->getNumParams(), params->size(), (params->size() == 1));
49864986

4987-
bool onlyAnonymousParams =
4987+
// Unsed parameter is represented by `_` before `in`.
4988+
bool onlyUnusedParams =
49884989
std::all_of(params->begin(), params->end(),
49894990
[](ParamDecl *param) { return !param->hasName(); });
49904991

49914992
// If closure expects no parameters but N was given,
4992-
// and all of them are anonymous let's suggest removing them.
4993-
if (fnType->getNumParams() == 0 && onlyAnonymousParams) {
4993+
// and all of them are unused, let's suggest removing them.
4994+
if (fnType->getNumParams() == 0 && onlyUnusedParams) {
49944995
auto inLoc = closure->getInLoc();
49954996
auto &sourceMgr = getASTContext().SourceMgr;
49964997

0 commit comments

Comments
 (0)