920d1d85e1
Initial: https://dart-review.googlesource.com/c/sdk/+/195302 Reverted: https://dart-review.googlesource.com/c/sdk/+/196282 Internal presubmit looks green. https://test.corp.google.com/ui#id=OCL:372759773:BASE:372759779:1620532577947:b5e08140 Change-Id: I7348692e1f34f26a9aca48902abb16df50fda2c5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198920 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
18 lines
536 B
Dart
18 lines
536 B
Dart
// 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.
|
|
|
|
/// 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();
|
|
}
|