Files
sdk/pkg/front_end/testcases/coverage/metadata_variable_declaration.dart
Jens Johansen 47dc4663d8 [CFE] Increase test coverage 01
Increase test coverage --- body_builder.dart was the target.

Process: Replaced all `coverage-ignore-block(suite):` comments with
throws and ran `python3 tools/test.py -n cfe-strong-linux language/`,
copying (and modifying) representative tests from `langauge` that
covered new stuff (i.e. threw in the modified version). Then undid the
throw changes, and redid the coverage marking.
Change-Id: Ie08dc6fcd70cd3722b68c38bf2a152d03aae7885
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378705
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-08-05 08:26:09 +00:00

45 lines
1.3 KiB
Dart

// Copyright (c) 2024, 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.
// Based on tests/language/variable/variable_declaration_metadata_test.dart
// Verify that the individual variable declarations inside a variable
// declaration list are not allowed to be annotated with metadata.
const annotation = null;
var v0; // OK
var @annotation v1; // Error
var v2, @annotation v3; // Error
int v4 = -1; // This should by itself be fine, but recovery is bad.
int @annotation v5 = -1; // Error --- I think this is where the bad recovery happens.
int v6 = -1, @annotation v7 = -1; // Error
class C {
var f0; // OK
var @annotation f1; // Error
var f2, @annotation f3; // Error
int f4 = -1; // This should by itself be fine, but recovery is bad.
int @annotation f5 = -1; // Error
int f6 = -1, @annotation f7 = -1; // Error
}
void foo() {
var l0; // OK
var @annotation l1; // Error
var l2, @annotation l3; // Error
int l4 = -1; // This should by itself be fine, but recovery is bad.
int @annotation l5 = -1; // Error
int l6 = -1, @annotation l7 = -1; // Error
for (
var @annotation i1 = 0, @annotation i2 = 0 // Error
;;) {
break;
}
}