blob: 3d6c05c8a553e21b37ecf1828f58effbb5106d96 [file] [log] [blame]
// Copyright (c) 2019, 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.
// @dart = 2.9
/// Catch illegal access to 'this' in initialized instance fields.
class A {
var x = 5;
var arr = [x]; // Illegal access to 'this'.
// ^
// [analyzer] COMPILE_TIME_ERROR.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER
// [cfe] Can't access 'this' in a field initializer to read 'x'.
}
void main() {
A();
}