d074bb1596
Instead of highlighting the entire constructor, which might be long, we now highlight just the keyword `const`. Change-Id: Ie520db0a2fcaf05db79d9e49e08f06a5212fef7f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152727 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
24 lines
544 B
Dart
24 lines
544 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();
|
|
// ^
|
|
// [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;
|
|
}
|