Skip to content

Commit 099eb46

Browse files
committed
[Diagnostics] Improve insertion location check when handling a missing argument
1 parent 0ad185a commit 099eb46

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,6 +5338,8 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
53385338
// fn(argX, argY):
53395339
// fn(argX, argY[, argMissing])
53405340
if (args->empty()) {
5341+
if (!args->getRParenLoc().isValid())
5342+
return false;
53415343
insertLoc = args->getRParenLoc();
53425344
} else if (position != 0) {
53435345
auto argPos = std::min(args->size(), position) - 1;
@@ -5377,9 +5379,6 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
53775379
}
53785380
}
53795381

5380-
if (insertLoc.isInvalid())
5381-
return false;
5382-
53835382
// If we are trying to insert a trailing closure but the parameter
53845383
// corresponding to the missing argument doesn't support a trailing closure,
53855384
// don't provide a Fix-It.

0 commit comments

Comments
 (0)