Files
sdk/tests/language_2/field/field3_test.dart
T
Robert Nystrom fc1b1ecc71 Move files under language_2 into subdirectories.
Change-Id: Idbcc965a27e9ffeedf5e0a1068b019de4193070f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127745
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-12-11 19:18:00 +00:00

31 lines
985 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.
// Dart test to catch error reporting bugs in class fields declarations.
import "package:expect/expect.dart";
class C {
// illegal: var cannot follow final
final var a = 0;// //# 00: syntax error
// illegal: final field declaration, must be initialized
final b; // //# 01: compile-time error
final c; // //# 02: compile-time error
final d; // //# 03: ok
final e; // //# 04: ok
final f = 0; // //# 05: ok
C() {} //# 02: continued
C(this.d) {} //# 03: continued
C(x) : e = x {} //# 04: continued
}
main() {
var val = new C(); //# 00: continued
var val = new C(); //# 01: continued
var val = new C(); //# 02: continued
var val = new C(0); //# 03: continued
var val = new C(0); //# 04: continued
var val = new C(); //# 05: continued
}