Files
sdk/pkg/front_end/testcases/nnbd/required_named_parameter.dart
T
Dmitry Stefantsov c05e2f1177 [cfe] Report errors on missing default values of optional parameters
The CL also fixes a bug: the required modifier in parameters of local
functions and function expressions wasn't handled.

Closes #40085.

Bug: http://dartbug.com/40085
Change-Id: Ic75fca5870f567ddf2e19aa3a96f83e9117540ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132280
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-01-23 15:51:37 +00:00

16 lines
471 B
Dart

// Copyright (c) 2020, 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.
// Should be a compile-time error / warning.
foo({required int parameter = 42}) {}
foo2({int parameter}) {}
foo3([int parameter]) {}
// Should be ok.
bar({required int parameter}) {}
bar2({int parameter = 42}) {}
bar3([int parameter = 42]) {}
main() {}