From c0baa10186de31245f23386793acb4f777a8fd74 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Fri, 22 Nov 2024 11:23:09 +0200 Subject: [PATCH] Fixes #2991. Fix typos and separate tests with `external` --- .../Types/Type_Void/type_void_A06_t11.dart | 1 + .../nnbd/static_errors_A04_t21.dart | 5 +-- .../nnbd/static_errors_A04_t22.dart | 5 +-- .../nnbd/static_errors_A04_t23.dart | 5 +-- .../nnbd/static_errors_A04_t24.dart | 5 +-- .../nnbd/static_errors_A04_t28.dart | 5 +-- .../nnbd/static_errors_A04_t29.dart | 10 +----- .../nnbd/static_errors_A04_t30.dart | 5 +-- .../nnbd/static_errors_A04_t33.dart | 6 +--- .../nnbd/static_errors_A04_t35.dart | 25 +++++++++++++ .../nnbd/static_errors_A04_t36.dart | 25 +++++++++++++ .../nnbd/static_errors_A04_t37.dart | 27 ++++++++++++++ .../nnbd/static_errors_A04_t38.dart | 27 ++++++++++++++ .../nnbd/static_errors_A04_t39.dart | 27 ++++++++++++++ .../nnbd/static_errors_A04_t40.dart | 32 +++++++++++++++++ .../nnbd/static_errors_A04_t41.dart | 29 +++++++++++++++ .../nnbd/static_errors_A04_t42.dart | 29 +++++++++++++++ .../nnbd/static_errors_A05_t21.dart | 7 ++-- .../nnbd/static_errors_A05_t22.dart | 7 ++-- .../nnbd/static_errors_A05_t23.dart | 7 ++-- .../nnbd/static_errors_A05_t24.dart | 7 ++-- .../nnbd/static_errors_A05_t26.dart | 7 ++-- .../nnbd/static_errors_A05_t27.dart | 7 ++-- .../nnbd/static_errors_A05_t28.dart | 7 ++-- .../nnbd/static_errors_A05_t29.dart | 10 ++---- .../nnbd/static_errors_A05_t30.dart | 5 +-- .../nnbd/static_errors_A05_t32.dart | 7 ++-- .../nnbd/static_errors_A05_t33.dart | 5 +-- .../nnbd/static_errors_A05_t34.dart | 7 ++-- .../nnbd/static_errors_A05_t35.dart | 27 ++++++++++++++ .../nnbd/static_errors_A05_t36.dart | 27 ++++++++++++++ .../nnbd/static_errors_A05_t37.dart | 29 +++++++++++++++ .../nnbd/static_errors_A05_t38.dart | 29 +++++++++++++++ .../nnbd/static_errors_A05_t39.dart | 28 +++++++++++++++ .../nnbd/static_errors_A05_t40.dart | 28 +++++++++++++++ .../nnbd/static_errors_A05_t41.dart | 30 ++++++++++++++++ .../nnbd/static_errors_A05_t42.dart | 35 +++++++++++++++++++ .../nnbd/static_errors_A05_t43.dart | 32 +++++++++++++++++ .../nnbd/static_errors_A05_t44.dart | 30 ++++++++++++++++ .../nnbd/static_errors_A05_t45.dart | 30 ++++++++++++++++ .../nnbd/static_errors_A05_t46.dart | 32 +++++++++++++++++ .../nnbd/static_errors_A06_t28.dart | 8 +---- .../nnbd/static_errors_A06_t29.dart | 26 ++++++-------- .../nnbd/static_errors_A06_t30.dart | 34 ++++++++++++++++++ .../nnbd/static_errors_A06_t31.dart | 30 ++++++++++++++++ 45 files changed, 684 insertions(+), 122 deletions(-) create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t35.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t36.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t37.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t38.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t39.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t40.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t41.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A04_t42.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t35.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t36.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t37.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t38.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t39.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t40.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t41.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t42.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t43.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t44.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t45.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A05_t46.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A06_t30.dart create mode 100644 LanguageFeatures/nnbd/static_errors_A06_t31.dart diff --git a/Language/Types/Type_Void/type_void_A06_t11.dart b/Language/Types/Type_Void/type_void_A06_t11.dart index 69560f0737..a59b4ad441 100644 --- a/Language/Types/Type_Void/type_void_A06_t11.dart +++ b/Language/Types/Type_Void/type_void_A06_t11.dart @@ -18,3 +18,4 @@ main() { // ^^^^ // [analyzer] unspecified // [cfe] unspecified} +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t21.dart b/LanguageFeatures/nnbd/static_errors_A04_t21.dart index 2f03716312..df0988500a 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t21.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t21.dart @@ -8,19 +8,16 @@ /// /// @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`. +/// `late` modifier. Test type `Never`. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong 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() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t22.dart b/LanguageFeatures/nnbd/static_errors_A04_t22.dart index 4378b75c9c..11aa1c650b 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t22.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t22.dart @@ -8,19 +8,16 @@ /// /// @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`. +/// `late` modifier. Test type `Function`. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong 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() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t23.dart b/LanguageFeatures/nnbd/static_errors_A04_t23.dart index 77f56059b5..c9dad9e906 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t23.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t23.dart @@ -8,7 +8,7 @@ /// /// @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. +/// `late` modifier. Test a function type. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -16,13 +16,10 @@ typedef void Foo(); 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() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t24.dart b/LanguageFeatures/nnbd/static_errors_A04_t24.dart index 7873238963..37633bae0e 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t24.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t24.dart @@ -8,7 +8,7 @@ /// /// @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. +/// `late` modifier. Test some class. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -16,13 +16,10 @@ class A {} 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() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t28.dart b/LanguageFeatures/nnbd/static_errors_A04_t28.dart index b28d219c82..9303cb05e4 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t28.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t28.dart @@ -8,7 +8,7 @@ /// /// @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`. +/// `late` modifier. Test type `FutureOr`. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -16,13 +16,10 @@ import "dart:async"; late FutureOr x1; -external FutureOr x2; class C { static late FutureOr x1; static late final FutureOr x2; - external static FutureOr x3; - external static final FutureOr x4; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t29.dart b/LanguageFeatures/nnbd/static_errors_A04_t29.dart index d6a317b247..cb5ec6e110 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t29.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t29.dart @@ -8,8 +8,7 @@ /// /// @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 `FutureOr` where `F` is a function -/// type. +/// `late` modifier. Test `FutureOr` where `F` is a function type. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -20,19 +19,12 @@ typedef void Foo(); late FutureOr f1; late FutureOr f2; -external FutureOr f3; -external FutureOr f4; class C { static late FutureOr x1; static late final FutureOr x2; static late FutureOr x3; static late final FutureOr x4; - - external static FutureOr x5; - external static final FutureOr x6; - external static FutureOr x7; - external static final FutureOr x8; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t30.dart b/LanguageFeatures/nnbd/static_errors_A04_t30.dart index a89e4529c5..ac3f58a045 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t30.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t30.dart @@ -8,7 +8,7 @@ /// /// @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 `FutureOr` where `A` is some class. +/// `late` modifier. Test `FutureOr` where `A` is some class. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -18,13 +18,10 @@ import "dart:async"; class A {} late FutureOr x1; -external FutureOr x2; class C { static late FutureOr x1; static late final FutureOr x2; - external static FutureOr x3; - external static final FutureOr x4; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t33.dart b/LanguageFeatures/nnbd/static_errors_A04_t33.dart index 22a80a04a6..8a3add378d 100644 --- a/LanguageFeatures/nnbd/static_errors_A04_t33.dart +++ b/LanguageFeatures/nnbd/static_errors_A04_t33.dart @@ -8,8 +8,7 @@ /// /// @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 `FutureOr>` where `A` is -/// some class. +/// `late` modifier. Test `FutureOr>` where `A` is some class. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -19,13 +18,10 @@ import "dart:async"; class A {} late FutureOr> x1; -external FutureOr> x2; class C { static late FutureOr> x1; static late final FutureOr> x2; - external static FutureOr> x3; - external static final FutureOr> x4; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A04_t35.dart b/LanguageFeatures/nnbd/static_errors_A04_t35.dart new file mode 100644 index 0000000000..cce4646b26 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t35.dart @@ -0,0 +1,25 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external` modifier. Test type `Never`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +external Never n1; + +class C { + external static Never n1; + external static final Never n2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t36.dart b/LanguageFeatures/nnbd/static_errors_A04_t36.dart new file mode 100644 index 0000000000..20acac234f --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t36.dart @@ -0,0 +1,25 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external` modifier. Test type `Function`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +external Function x1; + +class C { + external static Function x1; + external static final Function x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t37.dart b/LanguageFeatures/nnbd/static_errors_A04_t37.dart new file mode 100644 index 0000000000..6f0ff93275 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t37.dart @@ -0,0 +1,27 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external` modifier. Test a function type. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +typedef void Foo(); + +external Foo x1; + +class C { + external static Foo x1; + external static final Foo x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t38.dart b/LanguageFeatures/nnbd/static_errors_A04_t38.dart new file mode 100644 index 0000000000..0c92e1a1d6 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t38.dart @@ -0,0 +1,27 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external` modifier. Test some class. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +class A {} + +external A x1; + +class C { + external static A x1; + external static final A x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t39.dart b/LanguageFeatures/nnbd/static_errors_A04_t39.dart new file mode 100644 index 0000000000..ba2d52903f --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t39.dart @@ -0,0 +1,27 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external` modifier. Test type `FutureOr`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +external FutureOr x1; + +class C { + external static FutureOr x1; + external static final FutureOr x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t40.dart b/LanguageFeatures/nnbd/static_errors_A04_t40.dart new file mode 100644 index 0000000000..9447193f14 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t40.dart @@ -0,0 +1,32 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external` modifier. Test `FutureOr` where `F` is a function type. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +typedef void Foo(); + +external FutureOr f1; +external FutureOr f2; + +class C { + external static FutureOr x1; + external static final FutureOr x2; + external static FutureOr x3; + external static final FutureOr x4; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t41.dart b/LanguageFeatures/nnbd/static_errors_A04_t41.dart new file mode 100644 index 0000000000..e6bca1d9a5 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t41.dart @@ -0,0 +1,29 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external `modifier. Test `FutureOr` where `A` is some class. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class A {} + +external FutureOr x1; + +class C { + external static FutureOr x1; + external static final FutureOr x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A04_t42.dart b/LanguageFeatures/nnbd/static_errors_A04_t42.dart new file mode 100644 index 0000000000..ac406bb937 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A04_t42.dart @@ -0,0 +1,29 @@ +// 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. + +/// @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 a `late` or `external` modifier. +/// +/// @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 an +/// `external `modifier. Test `FutureOr>` where `A` is some class. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class A {} + +external FutureOr> x1; + +class C { + external static FutureOr> x1; + external static final FutureOr> x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t21.dart b/LanguageFeatures/nnbd/static_errors_A05_t21.dart index aa6e240b83..2518cac119 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t21.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t21.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// type `Never`. +/// the variable is marked with a `late` or `abstract` modifier. Test type +/// `Never` /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -28,9 +28,6 @@ class C { late Never n1; late final Never n2; covariant late Never n3; - - external Never n4; - external final Never n5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t22.dart b/LanguageFeatures/nnbd/static_errors_A05_t22.dart index 67be144a0b..f71ff590df 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t22.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t22.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// type `Function`. +/// the variable is marked with a `late` or `abstract` modifier. Test type +/// `Function`. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -28,9 +28,6 @@ class C { late Function x1; late final Function x2; covariant late Function x3; - - external Function x4; - external final Function x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t23.dart b/LanguageFeatures/nnbd/static_errors_A05_t23.dart index 9db07409e2..70319c9b29 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t23.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t23.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// a function type. +/// the variable is marked with a `late` or `abstract` modifier. Test a function +/// type. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -30,9 +30,6 @@ class C { late Foo x1; late final Foo x2; covariant late Foo x3; - - external Foo x4; - external final Foo x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t24.dart b/LanguageFeatures/nnbd/static_errors_A05_t24.dart index e03baa43aa..cbc7b2369d 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t24.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t24.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// some class `A`. +/// the variable is marked with a `late` or `abstract` modifier. Test some class +/// `A`. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -30,9 +30,6 @@ class C { late A x1; late final A x2; covariant late A x3; - - external A x4; - external final A x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t26.dart b/LanguageFeatures/nnbd/static_errors_A05_t26.dart index 8e7683c57a..6762284aef 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t26.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t26.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// some type ``. +/// the variable is marked with a `late` or `abstract` modifier. Test some type +/// ``. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -28,9 +28,6 @@ class C { late X x1; late final X x2; covariant late X x3; - - external X x4; - external final X x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t27.dart b/LanguageFeatures/nnbd/static_errors_A05_t27.dart index 9e2250efe2..70cb0fb14e 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t27.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t27.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// type ``. +/// the variable is marked with a `late` or `abstract` modifier. Test type +/// ``. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -28,9 +28,6 @@ class C { late X x1; late final X x2; covariant late X x3; - - external X x4; - external final X x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t28.dart b/LanguageFeatures/nnbd/static_errors_A05_t28.dart index a78cc58591..1b6b2b76a8 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t28.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t28.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// type `FutureOr`. +/// the variable is marked with a `late` or `abstract` modifier. Test type +/// `FutureOr`. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -30,9 +30,6 @@ class C { late FutureOr x1; late final FutureOr x2; covariant late FutureOr x3; - - external FutureOr x4; - external final FutureOr x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t29.dart b/LanguageFeatures/nnbd/static_errors_A05_t29.dart index 582b4cfca2..7d2c563cc1 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t29.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t29.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. -/// Test `FutureOr` where `F` is a function type +/// the variable is marked with a `late` or `abstract` modifier. Test +/// `FutureOr` where `F` is a function type. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -36,12 +36,6 @@ class C { late FutureOr x4; late final FutureOr x5; covariant late FutureOr x6; - - external FutureOr x7; - external final FutureOr x8; - - external FutureOr x9; - external final FutureOr x10; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t30.dart b/LanguageFeatures/nnbd/static_errors_A05_t30.dart index 24f575ce54..09e4dee52b 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t30.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t30.dart @@ -12,7 +12,7 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test +/// the variable is marked with a `late` or `abstract` modifier. Test /// `FutureOr` where `A` is some class. /// @author sgrekhov@unipro.ru @@ -31,9 +31,6 @@ class C { late FutureOr x1; late final FutureOr x2; covariant late FutureOr x3; - - external FutureOr x4; - external final FutureOr x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t32.dart b/LanguageFeatures/nnbd/static_errors_A05_t32.dart index f207f42813..92457e0461 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t32.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t32.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test -/// type `FutureOr`, where ``. +/// the variable is marked with a `late` or `abstract` modifier. Test type +/// `FutureOr`, where ``. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -30,9 +30,6 @@ class C { late FutureOr x1; late final FutureOr x2; covariant late FutureOr x3; - - external FutureOr x4; - external final FutureOr x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t33.dart b/LanguageFeatures/nnbd/static_errors_A05_t33.dart index a2f63f734e..03771cba23 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t33.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t33.dart @@ -12,7 +12,7 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. Test +/// the variable is marked with a `late` or `abstract` modifier. Test /// `FutureOr`, where ``. /// @author sgrekhov@unipro.ru @@ -30,9 +30,6 @@ class C { late FutureOr x1; late final FutureOr x2; covariant late FutureOr x3; - - external FutureOr x4; - external final FutureOr x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t34.dart b/LanguageFeatures/nnbd/static_errors_A05_t34.dart index 207ca35f02..9a8cae281e 100644 --- a/LanguageFeatures/nnbd/static_errors_A05_t34.dart +++ b/LanguageFeatures/nnbd/static_errors_A05_t34.dart @@ -12,8 +12,8 @@ /// an instance variable with a potentially non-nullable type and no initializer /// expression, and the class has a generative constructor where the variable is /// not initialized via an initializing formal or an initializer list entry, but -/// the variable is marked with `late`, `abstract`, or `external` modifier. -/// Test `FutureOr>` where `A` is some class. +/// the variable is marked with a `late` or `abstract` modifier. Test +/// `FutureOr>` where `A` is some class. /// @author sgrekhov@unipro.ru // Requirements=nnbd-strong @@ -32,9 +32,6 @@ class C { late FutureOr> x1; late final FutureOr> x2; covariant late FutureOr> x3; - - external FutureOr> x4; - external final FutureOr> x5; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A05_t35.dart b/LanguageFeatures/nnbd/static_errors_A05_t35.dart new file mode 100644 index 0000000000..1f6fc861b0 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t35.dart @@ -0,0 +1,27 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test type `Never`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +class C { + external Never n1; + external final Never n2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t36.dart b/LanguageFeatures/nnbd/static_errors_A05_t36.dart new file mode 100644 index 0000000000..44d2bdd7f3 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t36.dart @@ -0,0 +1,27 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test type `Function`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +class C { + external Function x1; + external final Function x2; +} + +main() { + new C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t37.dart b/LanguageFeatures/nnbd/static_errors_A05_t37.dart new file mode 100644 index 0000000000..8441ce22ff --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t37.dart @@ -0,0 +1,29 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test a function type. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +typedef void Foo(); + +class C { + external Foo x1; + external final Foo x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t38.dart b/LanguageFeatures/nnbd/static_errors_A05_t38.dart new file mode 100644 index 0000000000..ab55efb1b1 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t38.dart @@ -0,0 +1,29 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test some class `A`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +class A {} + +class C { + external A x1; + external final A x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t39.dart b/LanguageFeatures/nnbd/static_errors_A05_t39.dart new file mode 100644 index 0000000000..53e65724a7 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t39.dart @@ -0,0 +1,28 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test some type +/// ``. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +class C { + external X x1; + external final X x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t40.dart b/LanguageFeatures/nnbd/static_errors_A05_t40.dart new file mode 100644 index 0000000000..c3cfb96992 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t40.dart @@ -0,0 +1,28 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test type +/// ``. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +class C { + external X x1; + external final X x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t41.dart b/LanguageFeatures/nnbd/static_errors_A05_t41.dart new file mode 100644 index 0000000000..b9ae0708eb --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t41.dart @@ -0,0 +1,30 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test type +/// `FutureOr`. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class C { + external FutureOr x4; + external final FutureOr x5; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t42.dart b/LanguageFeatures/nnbd/static_errors_A05_t42.dart new file mode 100644 index 0000000000..ee85e7da76 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t42.dart @@ -0,0 +1,35 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an`external` modifier. Test `FutureOr` where +/// `F` is a function type. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +typedef void Foo(); + +class C { + external FutureOr x1; + external final FutureOr x2; + + external FutureOr x3; + external final FutureOr x4; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t43.dart b/LanguageFeatures/nnbd/static_errors_A05_t43.dart new file mode 100644 index 0000000000..caf78f3808 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t43.dart @@ -0,0 +1,32 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an`external` modifier. Test `FutureOr` where +/// `A` is some class. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class A {} + +class C { + external FutureOr x1; + external final FutureOr x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t44.dart b/LanguageFeatures/nnbd/static_errors_A05_t44.dart new file mode 100644 index 0000000000..4c59b8304c --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t44.dart @@ -0,0 +1,30 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test type `FutureOr`, +/// where ``. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class C { + external FutureOr x1; + external final FutureOr x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t45.dart b/LanguageFeatures/nnbd/static_errors_A05_t45.dart new file mode 100644 index 0000000000..9b268a57ee --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t45.dart @@ -0,0 +1,30 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test `FutureOr`, +/// where ``. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class C { + external FutureOr x1; + external final FutureOr x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A05_t46.dart b/LanguageFeatures/nnbd/static_errors_A05_t46.dart new file mode 100644 index 0000000000..7c5ed808b2 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A05_t46.dart @@ -0,0 +1,32 @@ +// 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. + +/// @assertion It is an error if a class declaration declares an instance +/// variable with a potentially non-nullable type and no initializer expression, +/// and the class has a generative constructor where the variable is not +/// initialized via an initializing formal or an initializer list entry, unless +/// the variable is marked with a `late`, `abstract`, or `external` modifier. +/// +/// @description Check that it is not an error if a class declaration declares +/// an instance variable with a potentially non-nullable type and no initializer +/// expression, and the class has a generative constructor where the variable is +/// not initialized via an initializing formal or an initializer list entry, but +/// the variable is marked with an `external` modifier. Test +/// `FutureOr>` where `A` is some class. +/// @author sgrekhov22@gmail.com + +// Requirements=nnbd-strong + +import "dart:async"; + +class A {} + +class C { + external FutureOr> x1; + external final FutureOr> x2; +} + +main() { + C(); +} diff --git a/LanguageFeatures/nnbd/static_errors_A06_t28.dart b/LanguageFeatures/nnbd/static_errors_A06_t28.dart index 48408358c6..ff3d9873d0 100644 --- a/LanguageFeatures/nnbd/static_errors_A06_t28.dart +++ b/LanguageFeatures/nnbd/static_errors_A06_t28.dart @@ -11,7 +11,7 @@ /// @description Check that it is not an error if a mixin declaration or a class /// declaration with no generative constructors declares an instance variable /// without an initializing expression which is final but it is marked with -/// `late`, `abstract` or `external`. +/// `late` or `abstract`. /// @author sgrekhov22@gmail.com abstract class C { @@ -21,9 +21,6 @@ abstract class C { abstract final v4; abstract final Object v5; abstract final T v6; - external final v7; - external final Object v8; - external final T v9; } mixin M { @@ -33,9 +30,6 @@ mixin M { abstract final v4; abstract final Object v5; abstract final T v6; - external final v7; - external final Object v8; - external final T v9; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A06_t29.dart b/LanguageFeatures/nnbd/static_errors_A06_t29.dart index bef441dc9a..9af07350c0 100644 --- a/LanguageFeatures/nnbd/static_errors_A06_t29.dart +++ b/LanguageFeatures/nnbd/static_errors_A06_t29.dart @@ -10,26 +10,20 @@ /// /// @description Check that it is not an error if a mixin declaration or a class /// declaration with no generative constructors declares an instance variable -/// without an initializing expression whose type is potentially non-nullable -/// but it is marked with `late`, `abstract` or `external`. +/// without an initializing expression which is final but it is marked with +/// `external`. /// @author sgrekhov22@gmail.com -abstract class C { - late Object v1; - late T v2; - abstract Object v3; - abstract T v4; - external Object v5; - external T v6; +class C { + external final v1; + external final Object v2; + external final T v3; } -mixin M { - late Object v1; - late T v2; - abstract Object v3; - abstract T v4; - external Object v5; - external T v6; +mixin M { + external final v1; + external final Object v2; + external final T v3; } main() { diff --git a/LanguageFeatures/nnbd/static_errors_A06_t30.dart b/LanguageFeatures/nnbd/static_errors_A06_t30.dart new file mode 100644 index 0000000000..6c0d5b6bfd --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A06_t30.dart @@ -0,0 +1,34 @@ +// 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. + +/// @assertion It is an error if a mixin declaration or a class declaration with +/// no generative constructors declares an instance variable without an +/// initializing expression which is final or whose type is potentially +/// non-nullable, unless the variable is marked with a `late`, `abstract`, or +/// `external` modifier. +/// +/// @description Check that it is not an error if a mixin declaration or a class +/// declaration with no generative constructors declares an instance variable +/// without an initializing expression whose type is potentially non-nullable +/// but it is marked with `late` or `abstract`. +/// @author sgrekhov22@gmail.com + +abstract class C { + late Object v1; + late T v2; + abstract Object v3; + abstract T v4; +} + +mixin M { + late Object v1; + late T v2; + abstract Object v3; + abstract T v4; +} + +main() { + print(C); + print(M); +} diff --git a/LanguageFeatures/nnbd/static_errors_A06_t31.dart b/LanguageFeatures/nnbd/static_errors_A06_t31.dart new file mode 100644 index 0000000000..67b3d3e6d1 --- /dev/null +++ b/LanguageFeatures/nnbd/static_errors_A06_t31.dart @@ -0,0 +1,30 @@ +// 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. + +/// @assertion It is an error if a mixin declaration or a class declaration with +/// no generative constructors declares an instance variable without an +/// initializing expression which is final or whose type is potentially +/// non-nullable, unless the variable is marked with a `late`, `abstract`, or +/// `external` modifier. +/// +/// @description Check that it is not an error if a mixin declaration or a class +/// declaration with no generative constructors declares an instance variable +/// without an initializing expression whose type is potentially non-nullable +/// but it is marked with `external`. +/// @author sgrekhov22@gmail.com + +abstract class C { + external Object v1; + external T v2; +} + +mixin M { + external Object v1; + external T v2; +} + +main() { + print(C); + print(M); +}