mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema][SE-0060] Don't allow out of order argument
This commit is contained in:
@@ -540,19 +540,9 @@ matchCallArguments(ArrayRef<CallArgParam> args,
|
||||
continue;
|
||||
}
|
||||
|
||||
// The argument binds to a parameter that comes earlier than the
|
||||
// previous argument. This is fine so long as this parameter and all of
|
||||
// those parameters up to (and including) the previously-bound parameter
|
||||
// are either variadic or have a default argument.
|
||||
for (unsigned i = paramIdx; i != prevParamIdx + 1; ++i) {
|
||||
const auto ¶m = params[i];
|
||||
if (param.Variadic || param.HasDefaultArgument)
|
||||
continue;
|
||||
|
||||
unsigned prevArgIdx = parameterBindings[prevParamIdx].front();
|
||||
listener.outOfOrderArgument(argIdx, prevArgIdx);
|
||||
return true;
|
||||
}
|
||||
unsigned prevArgIdx = parameterBindings[prevParamIdx].front();
|
||||
listener.outOfOrderArgument(argIdx, prevArgIdx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user