8db3be7557
Invocation forwarders currently cannot distinguish a named parameter not passed from passed as `null`. Refactor `getNamedParameter` to return nullable index. When the index is not null it means that the named parameter is present, and its value may be `null`. This doesn't fix any of the existing tests so I added a regression test. (Bug originally discovered and fixed in https://dart-review.googlesource.com/c/sdk/+/278505) Change-Id: I960c674073b3d25c37e79f9836647882acaff08b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278745 Reviewed-by: Aske Simon Christensen <askesc@google.com> Commit-Queue: Ömer Ağacan <omersa@google.com> Reviewed-by: Joshua Litt <joshualitt@google.com>
19 lines
461 B
Dart
19 lines
461 B
Dart
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
class A {
|
|
int? test({int? a = 123}) {
|
|
return a;
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
dynamic x = A();
|
|
Expect.equals(null, x.test(a: null));
|
|
Expect.equals(123, x.test());
|
|
Expect.equals(456, x.test(a: 456));
|
|
}
|