mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +00:00
[ddc] Update dynamic NSM errors to match
Makes the error messages consistent between stable and canary mode. Change-Id: I2e7e0b78e2f81dedd24b6ef7cdd034dfe0c4b6a2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341390 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
d5d8486c25
commit
fbcae44b96
|
@ -214,7 +214,7 @@ String? _argumentErrors(Object type, @notNull List actuals, namedActuals) {
|
|||
var requiredCount = JS<int>('!', '#.length', requiredPositional);
|
||||
var actualsCount = actuals.length;
|
||||
if (actualsCount < requiredCount) {
|
||||
return 'Dynamic call with too few required positional arguments. '
|
||||
return 'Dynamic call with missing positional arguments. '
|
||||
'Expected: $requiredCount Actual: $actualsCount';
|
||||
}
|
||||
// Check for too many positional arguments.
|
||||
|
@ -293,15 +293,15 @@ String? _argumentErrors(Object type, @notNull List actuals, namedActuals) {
|
|||
var required = fType.args;
|
||||
int requiredCount = JS('!', '#.length', required);
|
||||
if (actualsCount < requiredCount) {
|
||||
return 'Dynamic call with too few arguments. '
|
||||
return 'Dynamic call with missing positional arguments. '
|
||||
'Expected: $requiredCount Actual: $actualsCount';
|
||||
}
|
||||
|
||||
// Check for too many postional arguments.
|
||||
// Check for too many positional arguments.
|
||||
var extras = actualsCount - requiredCount;
|
||||
var optionals = fType.optionals;
|
||||
if (extras > JS<int>('!', '#.length', optionals)) {
|
||||
return 'Dynamic call with too many arguments. '
|
||||
return 'Dynamic call with too many positional arguments. '
|
||||
'Expected: $requiredCount Actual: $actualsCount';
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,8 @@ void main() {
|
|||
expectThrowsNSMWithExactError(
|
||||
() => Function.apply(arity1Tearoff, [42, false]),
|
||||
"NoSuchMethodError: 'arity1'\n"
|
||||
"Dynamic call with too many arguments. Expected: 1 Actual: 2\n"
|
||||
"Dynamic call with too many positional arguments. "
|
||||
"Expected: 1 Actual: 2\n"
|
||||
"Receiver: ${Error.safeToString(arity1Tearoff)}\n"
|
||||
"Arguments: [42, false]");
|
||||
});
|
||||
|
@ -202,7 +203,8 @@ void main() {
|
|||
expectThrowsNSMWithExactError(
|
||||
() => Function.apply(arity1Tearoff, []),
|
||||
"NoSuchMethodError: 'arity1'\n"
|
||||
"Dynamic call with too few arguments. Expected: 1 Actual: 0\n"
|
||||
"Dynamic call with missing positional arguments. "
|
||||
"Expected: 1 Actual: 0\n"
|
||||
"Receiver: ${Error.safeToString(arity1Tearoff)}\n"
|
||||
"Arguments: []");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue