dart-sdk/tests/language_2/regress_29784_test.dart
Régis Crelier 98a253186c [VM parser] Disallow implicit reference to 'this' in assertion initializer (fixes #29784).
Add regression test.
Adjust various status files.

Change-Id: I97bdf960260f0a13c2cfc6d95299d67a44c2238d
Reviewed-on: https://dart-review.googlesource.com/11247
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-10-06 18:40:14 +00:00

22 lines
605 B
Dart

// Copyright (c) 2017, 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.
// VMOptions=--enable_asserts
// Verify that only static members can be accessed in initializers, and this
// applies to asserts in initializers.
import 'package:expect/expect.dart';
class A {
A.ok() : b = a; //# 01: compile-time error
A.ko() : assert(a == null); //# 02: compile-time error
var a, b;
}
main() {
new A.ok(); //# 01: continued
new A.ko(); //# 02: continued
}