d244eeb84c
The "@compile-error" comment is an old not-great way of defining static error tests. See: https://github.com/dart-lang/sdk/issues/45634 Change-Id: I3e10209e78e48893d2f2df7f8af7963d319efd9f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296405 Reviewed-by: Jake Macdonald <jakemac@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com>
18 lines
490 B
Dart
18 lines
490 B
Dart
// Copyright (c) 2011, 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.
|
|
// Test that setters are not invokable in the initializer list.
|
|
|
|
class A {
|
|
A() : a = 499;
|
|
// ^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.INITIALIZER_FOR_NON_EXISTENT_FIELD
|
|
// [cfe] 'a' isn't an instance field of this class.
|
|
|
|
set a(val) {}
|
|
}
|
|
|
|
main() {
|
|
new A();
|
|
}
|