mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:29:48 +00:00
c86af3c39b
Change-Id: I9ae6c17967c98770ed06dead200c8bd87ae7f2a9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309829 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Kallen Tu <kallentu@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
25 lines
610 B
Dart
25 lines
610 B
Dart
// Copyright (c) 2014, 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 {
|
|
final int i = f();
|
|
// ^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONST_EVAL_METHOD_INVOCATION
|
|
// [cfe] Method invocation is not a constant expression.
|
|
final int j = 1;
|
|
const A();
|
|
//^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST
|
|
}
|
|
|
|
int f() {
|
|
return 3;
|
|
}
|
|
|
|
main() {
|
|
const A().j;
|
|
}
|