Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2979. Update NNBD static errors tests. Part 1. #2980

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions LanguageFeatures/nnbd/static_errors_A04_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test Never
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test type `Never`.
/// @author sgrekhov@unipro.ru


Never n;
// ^
// [analyzer] unspecified
Expand All @@ -25,5 +24,5 @@ class C {
}

main() {
new C();
print(C);
}
13 changes: 6 additions & 7 deletions LanguageFeatures/nnbd/static_errors_A04_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test Function
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test type `Function`.
/// @author sgrekhov@unipro.ru


Function f;
// ^
// [analyzer] unspecified
Expand All @@ -25,5 +24,5 @@ class C {
}

main() {
new C();
print(C);
}
13 changes: 6 additions & 7 deletions LanguageFeatures/nnbd/static_errors_A04_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test function type
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test a function type.
/// @author sgrekhov@unipro.ru


typedef void Foo();

Foo f;
Expand All @@ -27,5 +26,5 @@ class C {
}

main() {
new C();
print(C);
}
13 changes: 6 additions & 7 deletions LanguageFeatures/nnbd/static_errors_A04_t04.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test some class A
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test some class.
/// @author sgrekhov@unipro.ru


class A {}

A a;
Expand All @@ -35,5 +34,5 @@ class C {
}

main() {
new C();
print(C);
}
13 changes: 6 additions & 7 deletions LanguageFeatures/nnbd/static_errors_A04_t08.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test FutureOr<Never>
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test type `FutureOr<Never>`.
/// @author sgrekhov@unipro.ru


import "dart:async";

FutureOr<Never> n;
Expand All @@ -27,5 +26,5 @@ class C {
}

main() {
new C();
print(C);
}
15 changes: 7 additions & 8 deletions LanguageFeatures/nnbd/static_errors_A04_t09.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test FutureOr<F> where F is
/// a function type
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test type `FutureOr<F>` where `F` is a
/// function type.
/// @author sgrekhov@unipro.ru


import "dart:async";

typedef void Foo();
Expand Down Expand Up @@ -40,5 +39,5 @@ class C {
}

main() {
new C();
print(C);
}
15 changes: 7 additions & 8 deletions LanguageFeatures/nnbd/static_errors_A04_t10.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test FutureOr<A> where A is
/// some class
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test type `FutureOr<A>` where `A` is
/// some class.
/// @author sgrekhov@unipro.ru


import "dart:async";

class A {}
Expand Down Expand Up @@ -40,5 +39,5 @@ class C {
}

main() {
new C();
print(C);
}
15 changes: 7 additions & 8 deletions LanguageFeatures/nnbd/static_errors_A04_t13.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is an error if a top level variable or static
/// variable with a non-nullable type has no initializer expression unless the
/// variable is marked with the `late` modifier. Test FutureOr<FutureOr<A>>
/// where A is some class
/// @description Check that it is an error if a top level or static variable
/// with a non-nullable type has no initializer expression and is not marked
/// with a `late` or `external `modifier. Test `FutureOr<FutureOr<A>>` where `A`
/// is some class.
/// @author sgrekhov@unipro.ru


import "dart:async";

class A {}
Expand Down Expand Up @@ -40,5 +39,5 @@ class C {
}

main() {
new C();
print(C);
}
18 changes: 11 additions & 7 deletions LanguageFeatures/nnbd/static_errors_A04_t21.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is not an error if a top level or static
/// variable with potentially non-nullable type has no initializer expression
/// but marked with a 'late' modifier. Test Never
/// @description Check that it is not an error if a top level or static variable
/// with a non-nullable type has no initializer expression but is marked with a
/// `late` or `external `modifier. Test type `Never`.
/// @author sgrekhov@unipro.ru

// Requirements=nnbd-strong
late Never n;

late Never n1;
external Never n2;

class C {
static late Never n1;
static late final Never n2;
external static Never n3;
external static final Never n4;
}

main() {
new C();
C();
}
15 changes: 9 additions & 6 deletions LanguageFeatures/nnbd/static_errors_A04_t22.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is not an error if a top level or static
/// variable with potentially non-nullable type has no initializer expression
/// but marked with a 'late' modifier. Test Function
/// @description Check that it is not an error if a top level or static variable
/// with a non-nullable type has no initializer expression but is marked with a
/// `late` or `external `modifier. Test type `Function`.
/// @author sgrekhov@unipro.ru

// Requirements=nnbd-strong

late Function x;
late Function x1;
external Function x2;

class C {
static late Function x1;
static late final Function x2;
external static Function x3;
external static final Function x4;
}

main() {
Expand Down
16 changes: 10 additions & 6 deletions LanguageFeatures/nnbd/static_errors_A04_t23.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is not an error if a top level or static
/// variable with potentially non-nullable type has no initializer expression
/// but marked with a 'late' modifier. Test function type
/// @description Check that it is not an error if a top level or static variable
/// with a non-nullable type has no initializer expression but is marked with a
/// `late` or `external `modifier. Test a function type.
/// @author sgrekhov@unipro.ru

// Requirements=nnbd-strong

typedef void Foo();

late Foo x;
late Foo x1;
external Foo x2;

class C {
static late Foo x1;
static late final Foo x2;
external static Foo x3;
external static final Foo x4;
}

main() {
Expand Down
16 changes: 10 additions & 6 deletions LanguageFeatures/nnbd/static_errors_A04_t24.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is not an error if a top level or static
/// variable with potentially non-nullable type has no initializer expression
/// but marked with a 'late' modifier. Test some class A
/// @description Check that it is not an error if a top level or static variable
/// with a non-nullable type has no initializer expression but is marked with a
/// `late` or `external `modifier. Test some class.
/// @author sgrekhov@unipro.ru

// Requirements=nnbd-strong

class A {}

late A x;
late A x1;
external A x2;

class C {
static late A x1;
static late final A x2;
external static A x3;
external static final A x4;
}

main() {
Expand Down
17 changes: 11 additions & 6 deletions LanguageFeatures/nnbd/static_errors_A04_t28.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is an error if a top level variable or static variable with a
/// non-nullable type has no initializer expression unless the variable is marked
/// with the `late` modifier.
/// non-nullable type has no initializer expression unless the variable is
/// marked with a `late` or `external` modifier.
///
/// @description Check that it is not an error if a top level or static
/// variable with potentially non-nullable type has no initializer expression
/// but marked with a 'late' modifier. Test FutureOr<Never>
/// @description Check that it is not an error if a top level or static variable
/// with a non-nullable type has no initializer expression but is marked with a
/// `late` or `external `modifier. Test type `FutureOr<Never>`.
/// @author sgrekhov@unipro.ru

// Requirements=nnbd-strong

import "dart:async";
late FutureOr<Never> x;

late FutureOr<Never> x1;
external FutureOr<Never> x2;

class C {
static late FutureOr<Never> x1;
static late final FutureOr<Never> x2;
external static FutureOr<Never> x3;
external static final FutureOr<Never> x4;
}

main() {
Expand Down
Loading