dart-sdk/tests/language_2/assertion_initializer_const_function_test.dart
Bob Nystrom c7f6fea83f Update assertion_initializer_const_function[_error]_test.
Both of these were 1.0 tests that tested how a function argument to an
assert in an intiailizer were handled.

In 2.0, assert() no longer supports functions as their initial
parameter. I updated the test to reflect that. After that, the two tests
are identical, so I removed
assertion_initializer_const_function_error_test.

Change-Id: I41768c4c64459cfa80c817bf9a6c9dea3efd7fb0
Reviewed-on: https://dart-review.googlesource.com/14160
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2017-10-16 19:19:27 +00:00

19 lines
519 B
Dart

// Copyright (c) 2017, 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.
class C {
static bool staticTrue() => true;
final int x;
// Functions as parameters to assert are no longer supported in Dart 2.0, so
// this is now a static type error.
const C.bc01(this.x, y)
: assert(staticTrue) //# 01: compile-time error
;
}
main() {
new C.bc01(1, 2);
}