32d4ac903b
Fixes https://github.com/flutter/flutter/issues/56479 Change-Id: I3e308382bf64b1b1aa39174c2095ee7a465907a4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146980 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
20 lines
553 B
Dart
20 lines
553 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.
|
|
|
|
// Verifies that optional parameters can be transformed in field initializers.
|
|
// Regression test for https://github.com/flutter/flutter/issues/56479.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
int bar({int x = 2}) => x + 1;
|
|
|
|
class A {
|
|
static int foo = bar(x: 42);
|
|
}
|
|
|
|
main() {
|
|
Expect.equals(5, bar(x: 4));
|
|
Expect.equals(43, A.foo);
|
|
}
|