From c68ee75a365dc658a6f8e506d4f2cb7a91858f69 Mon Sep 17 00:00:00 2001 From: "Sergey G. Grekhov" Date: Fri, 21 Nov 2025 11:30:07 +0200 Subject: [PATCH] Fixes #3409. Add missing expected warnings --- .../syntax_assignment_A03_t01.dart | 10 ++++++++++ .../syntax_assignment_A03_t02.dart | 12 ++++++++++++ .../syntax_functions_A01_t01.dart | 10 ++++++++++ .../Null-aware-elements/syntax_logical_A01_t01.dart | 2 ++ .../syntax_new_const_A01_t01.dart | 4 ++++ .../Null-aware-elements/syntax_records_A01_t01.dart | 8 ++++++++ .../syntax_relational_A02_t01.dart | 4 ++++ .../syntax_this_super_A02_t01.dart | 2 ++ .../Null-aware-elements/syntax_throw_A01_t01.dart | 2 ++ .../syntax_unary_prefix_A02_t01.dart | 4 ++++ 10 files changed, 58 insertions(+) diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t01.dart index 87bd5872bc..d98000e4e7 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t01.dart @@ -136,19 +136,29 @@ main() { var map3 = { ?(a) = 1: ?(a) = 1, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?(b,) = (2,): ?(b,) = (2,), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?(name: c) = (name: 3): ?(name: c) = (name: 3), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?(d) = null: ?(d) = null, ?(e,) = (null,): ?(e,) = (null,), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?(name: f) = (name: null): ?(name: f) = (name: null) // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({ diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t02.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t02.dart index fa7923090e..dcf71c7242 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t02.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_assignment_A03_t02.dart @@ -163,21 +163,33 @@ main() { var map3 = { ?[a] = l1: ?[a] = l1, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?{"key1": b} = m1: ?{"key1": b} = m1, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?C(v: c) = c1: ?C(v: c) = c1, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?[d] = l2: ?[d] = l2, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?{"key2": e} = m2: ?{"key2": e} = m2, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?C(v: f) = c2: ?C(v: f) = c2 // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({l1: l1, m1: m1, c1: c1, l2: l2, m2: m2, c2: c2}, map3); diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_functions_A01_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_functions_A01_t01.dart index 45bab0c0fe..a9111c4c2a 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_functions_A01_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_functions_A01_t01.dart @@ -110,18 +110,28 @@ main() { var map3 = { ?C.new: ?C.new, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?() {}: ?() {}, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?() async {}: ?() async {}, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?() => 1: ?() => 1, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?() async => 1: ?() async => 1 // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.isTrue(map3 is Map); // ignore: unnecessary_type_check diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_logical_A01_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_logical_A01_t01.dart index 783070190a..f9ec2ea026 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_logical_A01_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_logical_A01_t01.dart @@ -56,6 +56,8 @@ main() { var map2 = { ?true || false: ?true && true // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({true: true}, map2); diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_new_const_A01_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_new_const_A01_t01.dart index abf2030c5d..dd9054507e 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_new_const_A01_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_new_const_A01_t01.dart @@ -58,9 +58,13 @@ main() { // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?new C(5): ?new C(5), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?const C(6): ?const C(6) // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; } diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_records_A01_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_records_A01_t01.dart index 82363ce585..b937dfdc28 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_records_A01_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_records_A01_t01.dart @@ -103,15 +103,23 @@ main() { var map2 = { ?(1, name: 2): ?(1, name: 2), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?(null, name: null): ?(null, name: null), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?const (3, name: 4): ?const (3, name: 4), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?const (null, name: null): ?const (null, name: null) // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({ diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_relational_A02_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_relational_A02_t01.dart index 585d2a7bc5..e5b16937ca 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_relational_A02_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_relational_A02_t01.dart @@ -63,9 +63,13 @@ main() { var map2 = { ?1 is String: ?1 is String, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?2 is! String: ?2 is! String, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({false: false, true: true}, map2); diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_this_super_A02_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_this_super_A02_t01.dart index 952cbedb3d..cccc44b1d5 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_this_super_A02_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_this_super_A02_t01.dart @@ -43,6 +43,8 @@ class C { // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?this: ?this, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({ diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_throw_A01_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_throw_A01_t01.dart index df99bdd467..93282cb19b 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_throw_A01_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_throw_A01_t01.dart @@ -54,6 +54,8 @@ main() { { ?throw "key": ?throw "value" // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; } diff --git a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_unary_prefix_A02_t01.dart b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_unary_prefix_A02_t01.dart index 16c5e614b2..9efd9bc778 100644 --- a/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_unary_prefix_A02_t01.dart +++ b/LanguageFeatures/Control-flow-collections/Null-aware-elements/syntax_unary_prefix_A02_t01.dart @@ -63,9 +63,13 @@ main() { var map2 = { ?!true: ?!true, // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR ?!(1 > 2): ?!(1 > 2), // ^ +// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR +// ^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR }; Expect.mapEquals({false: false, true: true}, map2);