Files
sdk/tests/language/nnbd/syntax/required_modifier_error_test.dart
T
Robert Nystrom 5bb9e922db Opt multitests out of formatting in language/.
The new formatter supports opting a region of code out from being
formatted. I'm applying this marker to all of the multitests since
those tests are often very sensitive to formatting and easily broken.
This way, anyone touching a multitest (including me when I reformat
the tests) doesn't have to remember to not run the formatter on it.

Unfortunately, this doesn't opt out 100# of the multitests. There are a
handful of multitests that also contain "@dart=" comments and are thus
formatted using the old style where the "// dart format off" marker has
no effect. For those, we'll have to still be careful to not accidentally
format them.

Change-Id: I257d0ee1eb44eee57047be06b8520f0ccc7b56d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396162
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2024-11-21 10:49:44 +00:00

42 lines
803 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.
// Formatting can break multitests, so don't format them.
// dart format off
// Invalid uses of "required" modifier
required //# 01: syntax error
int f1(
required //# 02: syntax error
int x
) => throw 0;
required //# 03: syntax error
class C1 {
required //# 04: syntax error
int f2 = 0;
}
// Duplicate modifier
void f2({
required
required //# 05: syntax error
int i,
}){
}
// Out of order modifiers
class C2 {
void m({
required int i1,
covariant required int i2, //# 07: syntax error
final required int i3, //# 08: syntax error
}) {
}
}
main() {
}