6cd3938741
https://github.com/dart-lang/sdk/issues/62799 https://github.com/dart-lang/sdk/issues/62944 https://github.com/dart-lang/sdk/issues/63002 https://github.com/dart-lang/sdk/issues/62970 Looks mostly green in google3: https://fusion2.corp.google.com/presubmit/901021300/OCL:901021300:BASE:901308428:1776439417713:37cd1695 Change-Id: I44754a48f66a0b58851d7c20fcfa61f7fb1b555a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488624 Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
19 lines
511 B
Dart
19 lines
511 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.
|
|
|
|
/// Fails because this.x parameter is used in a function.
|
|
|
|
class Foo {
|
|
var x;
|
|
foo(this.x) {}
|
|
// ^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR
|
|
// ^^^^^^
|
|
// [cfe] Field formal parameters can only be used in a constructor.
|
|
}
|
|
|
|
main() {
|
|
Foo().foo(2);
|
|
}
|