diff --git a/LanguageFeatures/nnbd/static_errors_A33_t09.dart b/LanguageFeatures/nnbd/static_errors_A33_t09.dart index 05804afc81..28cc67a5f7 100644 --- a/LanguageFeatures/nnbd/static_errors_A33_t09.dart +++ b/LanguageFeatures/nnbd/static_errors_A33_t09.dart @@ -18,8 +18,6 @@ void foo() {} main() { FutureOr f = foo; f!; -//^ -// [cfe] Operand of null-aware operation '!' has type 'FutureOr' which excludes null. // ^ // [analyzer] STATIC_WARNING.UNNECESSARY_NON_NULL_ASSERTION } diff --git a/LanguageFeatures/nnbd/weak/null_aware_operator_A13_t13.dart b/LanguageFeatures/nnbd/weak/null_aware_operator_A13_t13.dart index a43f4983d1..826e64d22f 100644 --- a/LanguageFeatures/nnbd/weak/null_aware_operator_A13_t13.dart +++ b/LanguageFeatures/nnbd/weak/null_aware_operator_A13_t13.dart @@ -14,6 +14,7 @@ /// @issue 40557 // Requirements=nnbd-weak + import "../../../Utils/expect.dart"; class C { @@ -38,18 +39,10 @@ class C { } void testShort(C? x, int index, dynamic value) { - var actual = x?[index] ??= value; -// ^^^^^ -// [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION -// ^ -// [cfe] Operand of null-aware operation '??=' has type 'int' which excludes null. + var actual = x?[index] ??= value; // ignore: dead_null_aware_expression var n0 = x; x?.init(); - var expected = n0 == null ? null : n0[index] ??= value; -// ^^^^^ -// [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION -// ^ -// [cfe] Operand of null-aware operation '??=' has type 'int' which excludes null. + var expected = n0 == null ? null : n0[index] ??= value; // ignore: dead_null_aware_expression Expect.equals(expected, actual); } diff --git a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t01.dart b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t01.dart index 6c3dd0301e..9c4198d15e 100644 --- a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t01.dart +++ b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t01.dart @@ -16,6 +16,7 @@ /// @issue 40959 // Requirements=nnbd-weak + import "../../../Utils/expect.dart"; class C { @@ -35,29 +36,17 @@ class C { main() { C c1 = new C(); - var actual1 = c1 ?.. test1; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual1 = c1 ?.. test1; // ignore: invalid_null_aware_operator var expected = c1; Expect.equals(expected, actual1); Expect.equals("test1 called 1 times, test2() called 0 times", c1.log); - var actual2 = c1 ?.. test2(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual2 = c1 ?.. test2(); // ignore: invalid_null_aware_operator Expect.equals(expected, actual2); Expect.equals("test1 called 1 times, test2() called 1 times", c1.log); var actual3 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 // ignore: invalid_null_aware_operator .. test2(); Expect.equals(expected, actual3); Expect.equals("test1 called 2 times, test2() called 2 times", c1.log); @@ -75,42 +64,18 @@ main() { Expect.isNull(actual6); c2 = new C(); - var actual7 = c2 ?.. test1; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual7 = c2 ?.. test1; // ignore: invalid_null_aware_operator var expected2 = c2; Expect.equals(expected2, actual7); - Expect.equals("test1 called 1 times, test2() called 0 times", c2?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 1 times, test2() called 0 times", c2?.log); // ignore: invalid_null_aware_operator - var actual8 = c2 ?.. test2(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual8 = c2 ?.. test2(); // ignore: invalid_null_aware_operator Expect.equals(expected2, actual8); - Expect.equals("test1 called 1 times, test2() called 1 times", c2?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 1 times, test2() called 1 times", c2?.log); // ignore: invalid_null_aware_operator var actual9 = c2 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 // ignore: invalid_null_aware_operator .. test2(); Expect.equals(expected2, actual9); - Expect.equals("test1 called 2 times, test2() called 2 times", c2?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 2 times, test2() called 2 times", c2?.log); // ignore: invalid_null_aware_operator } diff --git a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t02.dart b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t02.dart index d3c4e33f3c..8c54e5b451 100644 --- a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t02.dart +++ b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t02.dart @@ -16,6 +16,7 @@ /// @issue 39141 // Requirements=nnbd-weak + import '../../../Utils/expect.dart'; class C { @@ -38,31 +39,17 @@ typedef CAlias2 = C?; main() { CAlias1 c1 = new C(); - var actual1 = c1 ?.. test1; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - + var actual1 = c1 ?.. test1; // ignore: invalid_null_aware_operator var expected = c1; Expect.equals(expected, actual1); Expect.equals("test1 called 1 times, test2() called 0 times", c1.log); - var actual2 = c1 ?.. test2(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - + var actual2 = c1 ?.. test2(); // ignore: invalid_null_aware_operator Expect.equals(expected, actual2); Expect.equals("test1 called 1 times, test2() called 1 times", c1.log); var actual3 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 // ignore: invalid_null_aware_operator .. test2(); Expect.equals(expected, actual3); Expect.equals("test1 called 2 times, test2() called 2 times", c1.log); @@ -80,74 +67,37 @@ main() { Expect.isNull(actual6); c2 = new C(); - var actual7 = c2 ?.. test1; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual7 = c2 ?.. test1; // ignore: invalid_null_aware_operator var expected2 = c2; Expect.equals(expected2, actual7); - Expect.equals("test1 called 1 times, test2() called 0 times", c2?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. - - var actual8 = c2 ?.. test2(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + Expect.equals("test1 called 1 times, test2() called 0 times", c2?.log); // ignore: invalid_null_aware_operator + + var actual8 = c2 ?.. test2(); // ignore: invalid_null_aware_operator Expect.equals(expected2, actual8); - Expect.equals("test1 called 1 times, test2() called 1 times", c2?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 1 times, test2() called 1 times", c2?.log); // ignore: invalid_null_aware_operator var actual9 = c2 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 // ignore: invalid_null_aware_operator .. test2(); Expect.equals(expected2, actual9); - Expect.equals("test1 called 2 times, test2() called 2 times", c2?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 2 times, test2() called 2 times", c2?.log); // ignore: invalid_null_aware_operator + CAlias2 c3 = new C(); - var actual10 = c3 ?.. test1; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual10 = c3 ?.. test1; // ignore: invalid_null_aware_operator var expected3 = c3; Expect.equals(expected3, actual10); if (c3 != null) { Expect.equals("test1 called 1 times, test2() called 0 times", c3.log); } - var actual11 = c3 ?.. test2(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - + var actual11 = c3 ?.. test2(); // ignore: invalid_null_aware_operator Expect.equals(expected3, actual11); if (c3 != null) { Expect.equals("test1 called 1 times, test2() called 1 times", c3.log); } var actual12 = c3 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR - + ?.. test1 // ignore: invalid_null_aware_operator .. test2(); Expect.equals(expected3, actual12); if (c3 != null) { @@ -167,44 +117,19 @@ main() { Expect.isNull(actual15); c4 = new C(); - var actual16 = c4 ?.. test1; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual16 = c4 ?.. test1; // ignore: invalid_null_aware_operator var expected4 = c4; Expect.equals(expected4, actual16); - Expect.equals("test1 called 1 times, test2() called 0 times", c4?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. - - var actual17 = c4 ?.. test2(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + Expect.equals("test1 called 1 times, test2() called 0 times", c4?.log); // ignore: invalid_null_aware_operator + var actual17 = c4 ?.. test2(); // ignore: invalid_null_aware_operator Expect.equals(expected4, actual17); - Expect.equals("test1 called 1 times, test2() called 1 times", c4?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 1 times, test2() called 1 times", c4?.log); // ignore: invalid_null_aware_operator var actual18 = c4 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 // ignore: invalid_null_aware_operator .. test2(); Expect.equals(expected4, actual18); - Expect.equals("test1 called 2 times, test2() called 2 times", c4?.log); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("test1 called 2 times, test2() called 2 times", c4?.log); // ignore: invalid_null_aware_operator } diff --git a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t06.dart b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t06.dart index 09d4acaaa7..700bb6a27f 100644 --- a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t06.dart +++ b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t06.dart @@ -17,6 +17,7 @@ /// @issue 40959 // Requirements=nnbd-weak + import "../../../Utils/expect.dart"; class C { @@ -29,29 +30,17 @@ class C { main() { C c1 = new C(); - var actual1 = c1 ?.. test1 = "Show must go on"; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual1 = c1 ?.. test1 = "Show must go on"; // ignore: invalid_null_aware_operator var expected = c1; Expect.equals(expected, actual1); Expect.equals("Show must go on", c1.test1); - var actual2 = c1 ?.. test2 = "Lily was here"; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual2 = c1 ?.. test2 = "Lily was here"; // ignore: invalid_null_aware_operator Expect.equals(expected, actual2); Expect.equals("Lily was here", c1._test2); var actual3 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 = "Let it be" -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 = "Let it be" // ignore: invalid_null_aware_operator .. test2 = "Let it be"; Expect.equals(expected, actual3); Expect.equals("Let it be", c1.test1); @@ -70,47 +59,19 @@ main() { Expect.isNull(actual6); c2 = new C(); - var actual7 = c2 ?.. test1 = "Let it be"; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual7 = c2 ?.. test1 = "Let it be"; // ignore: invalid_null_aware_operator var expected2 = c2; Expect.equals(expected2, actual7); - Expect.equals("Let it be", c2?.test1); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("Let it be", c2?.test1); // ignore: invalid_null_aware_operator - var actual8 = c2 ?.. test2 = "Let it be"; -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual8 = c2 ?.. test2 = "Let it be"; // ignore: invalid_null_aware_operator Expect.equals(expected2, actual8); - Expect.equals("Let it be", c2?._test2); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("Let it be", c2?._test2); // ignore: invalid_null_aware_operator var actual9 = c2 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. test1 = "Show must go on" -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. test1 = "Show must go on" // ignore: invalid_null_aware_operator .. test2 = "Show must go on"; Expect.equals(expected2, actual9); - Expect.equals("Show must go on", c2?.test1); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. - Expect.equals("Show must go on", c2?._test2); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals("Show must go on", c2?.test1); // ignore: invalid_null_aware_operator + Expect.equals("Show must go on", c2?._test2); // ignore: invalid_null_aware_operator } diff --git a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t07.dart b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t07.dart index 472e76d337..ec9ea3441d 100644 --- a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t07.dart +++ b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t07.dart @@ -44,21 +44,13 @@ class C { main() { C c1 = new C(); - var actual1 = c1 ?.. m1().m(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual1 = c1 ?.. m1().m(); // ignore: invalid_null_aware_operator var expected = c1; Expect.equals(expected, actual1); Expect.equals(1, c1.m1().counter); var actual3 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1().m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1().m() // ignore: invalid_null_aware_operator .. m2().m(); Expect.equals(expected, actual3); Expect.equals(2, c1.m1().counter); @@ -74,25 +66,13 @@ main() { Expect.isNull(actual6); c2 = new C(); - var actual7 = c2 ?.. m1().m(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual7 = c2 ?.. m1().m(); // ignore: invalid_null_aware_operator var expected2 = c2; Expect.equals(expected2, actual7); - Expect.equals(1, c2?.m1().counter); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals(1, c2?.m1().counter); // ignore: invalid_null_aware_operator var actual9 = c2 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1().m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1().m() // ignore: invalid_null_aware_operator .. m2().m(); Expect.equals(expected2, actual9); Expect.equals(2, c2.m1().counter); diff --git a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t08.dart b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t08.dart index 2ad1396375..688bfbb8f3 100644 --- a/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t08.dart +++ b/LanguageFeatures/nnbd/weak/null_aware_operator_A17_t08.dart @@ -17,6 +17,7 @@ /// @issue 40959 // Requirements=nnbd-weak + import "../../../Utils/expect.dart"; class A { int counter = 0; @@ -44,11 +45,7 @@ class C { main() { C c1 = new C(); - var actual1 = c1 ?.. m1()?.m(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual1 = c1 ?.. m1()?.m(); // ignore: invalid_null_aware_operator var expected = c1; Expect.equals(expected, actual1); var val1 = c1.m1(); @@ -57,11 +54,7 @@ main() { } var actual2 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1()?.m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1()?.m() // ignore: invalid_null_aware_operator .. m2()?.m(); Expect.equals(expected, actual2); var val2 = c1.m1(); @@ -74,20 +67,12 @@ main() { } c1.a1 = null; - var actual3 = c1 ?.. m1()?.m(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual3 = c1 ?.. m1()?.m(); // ignore: invalid_null_aware_operator Expect.equals(expected, actual3); Expect.equals(5, c1.counter1); var actual4 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1()?.m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1()?.m() // ignore: invalid_null_aware_operator .. m2()?.m(); Expect.equals(expected, actual4); var val4 = c1.m2(); @@ -101,38 +86,22 @@ main() { if (c2 != null) { var actual6 = c2 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1()?.m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1()?.m() // ignore: invalid_null_aware_operator .. m2()?.m(); Expect.isNull(actual6); } c2 = new C(); - var actual7 = c2 ?.. m1()?.m(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual7 = c2 ?.. m1()?.m(); // ignore: invalid_null_aware_operator var expected2 = c2; Expect.equals(expected2, actual7); - var val5 = c2?.m1(); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + var val5 = c2?.m1(); // ignore: invalid_null_aware_operator if (val5 != null) { Expect.equals(1, val5.counter); } var actual8 = c2 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1()?.m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1()?.m() // ignore: invalid_null_aware_operator .. m2()?.m(); Expect.equals(expected2, actual8); var val6 = c2.m1(); @@ -145,20 +114,12 @@ main() { } c1.a1 = null; - var actual9 = c1 ?.. m1()?.m(); -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. + var actual9 = c1 ?.. m1()?.m(); // ignore: invalid_null_aware_operator Expect.equals(expected, actual9); Expect.equals(7, c1.counter1); var actual10 = c1 -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null. - ?.. m1()?.m() -// ^^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR + ?.. m1()?.m() // ignore: invalid_null_aware_operator .. m2()?.m(); Expect.equals(expected, actual10); var val8 = c1.m2(); diff --git a/LanguageFeatures/nnbd/weak/null_check_operator_A01_t01.dart b/LanguageFeatures/nnbd/weak/null_check_operator_A01_t01.dart index d9670521f1..15008275de 100644 --- a/LanguageFeatures/nnbd/weak/null_check_operator_A01_t01.dart +++ b/LanguageFeatures/nnbd/weak/null_check_operator_A01_t01.dart @@ -30,16 +30,8 @@ main() { Expect.throws(() {a!;}); Expect.throws(() {a!.foo();}); Expect.throws(() {a![42];}); - Expect.throws(() {a!?.foo();}); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'A' which excludes null. - Expect.throws(() {a!?[42];}); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'A' which excludes null. + Expect.throws(() {a!?.foo();}); // ignore: invalid_null_aware_operator + Expect.throws(() {a!?[42];}); // ignore: invalid_null_aware_operator Expect.throws(() {a!.s = "Lily was here";}); Expect.throws(() {a![0] = "Lily was here";}); A? a1 = new A(); diff --git a/LanguageFeatures/nnbd/weak/null_check_operator_A03_t02.dart b/LanguageFeatures/nnbd/weak/null_check_operator_A03_t02.dart index 8bc0eb31d0..b99ae5f84e 100644 --- a/LanguageFeatures/nnbd/weak/null_check_operator_A03_t02.dart +++ b/LanguageFeatures/nnbd/weak/null_check_operator_A03_t02.dart @@ -18,16 +18,8 @@ class C {} extension on C { test() { - Expect.equals("Lily was here: 42", this!(42)); -// ^ -// [analyzer] STATIC_WARNING.UNNECESSARY_NON_NULL_ASSERTION -// ^ -// [cfe] Operand of null-aware operation '!' has type 'C' which excludes null. - Expect.equals("Lily was here: 42", this(42)!); -// ^ -// [analyzer] STATIC_WARNING.UNNECESSARY_NON_NULL_ASSERTION -// ^ -// [cfe] Operand of null-aware operation '!' has type 'String' which excludes null. + Expect.equals("Lily was here: 42", this!(42)); // ignore: unnecessary_non_null_assertion + Expect.equals("Lily was here: 42", this(42)!); // ignore: unnecessary_non_null_assertion } String call(int v) => "Lily was here: $v"; } diff --git a/LanguageFeatures/nnbd/weak/null_check_operator_A03_t03.dart b/LanguageFeatures/nnbd/weak/null_check_operator_A03_t03.dart index 1c050a5378..c80bc9d2c2 100644 --- a/LanguageFeatures/nnbd/weak/null_check_operator_A03_t03.dart +++ b/LanguageFeatures/nnbd/weak/null_check_operator_A03_t03.dart @@ -17,16 +17,8 @@ import "../../../Utils/expect.dart"; class C { test() { - Expect.equals("Lily was here: 42", this!(42)); -// ^ -// [analyzer] STATIC_WARNING.UNNECESSARY_NON_NULL_ASSERTION -// ^ -// [cfe] Operand of null-aware operation '!' has type 'C' which excludes null. - Expect.equals("Lily was here: 42", this(42)!); -// ^ -// [analyzer] STATIC_WARNING.UNNECESSARY_NON_NULL_ASSERTION -// ^ -// [cfe] Operand of null-aware operation '!' has type 'String' which excludes null. + Expect.equals("Lily was here: 42", this!(42)); // ignore: unnecessary_non_null_assertion + Expect.equals("Lily was here: 42", this(42)!); // ignore: unnecessary_non_null_assertion } String call(int v) => "Lily was here: $v"; } diff --git a/LanguageFeatures/nnbd/weak/static_errors_A14_t03.dart b/LanguageFeatures/nnbd/weak/static_errors_A14_t03.dart index d3de914c27..052da37ee3 100644 --- a/LanguageFeatures/nnbd/weak/static_errors_A14_t03.dart +++ b/LanguageFeatures/nnbd/weak/static_errors_A14_t03.dart @@ -17,6 +17,7 @@ /// @author sgrekhov@unipro.ru // Requirements=nnbd-weak + typedef void Foo(); void foo() {} @@ -26,25 +27,15 @@ main() { f1?.toString(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?.' has type 'Function' which excludes null. f1 ?.. toString(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?..' has type 'Function' which excludes null. Foo f2 = foo; f2?.toString(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?.' has type 'void Function()' which excludes null. f2 ?.. toString(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?..' has type 'void Function()' which excludes null. } - - diff --git a/LanguageFeatures/nnbd/weak/static_errors_A14_t05.dart b/LanguageFeatures/nnbd/weak/static_errors_A14_t05.dart index 9e60f118c8..e1e9eae2c4 100644 --- a/LanguageFeatures/nnbd/weak/static_errors_A14_t05.dart +++ b/LanguageFeatures/nnbd/weak/static_errors_A14_t05.dart @@ -16,6 +16,7 @@ /// @author sgrekhov@unipro.ru // Requirements=nnbd-weak + class A { void test() {} int operator[](int index) => 0; @@ -26,16 +27,10 @@ main() { a?.test(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?.' has type 'A' which excludes null. a ?.. test(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?..' has type 'A' which excludes null. a?[0]; // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?.' has type 'A' which excludes null. } diff --git a/LanguageFeatures/nnbd/weak/static_errors_A14_t13.dart b/LanguageFeatures/nnbd/weak/static_errors_A14_t13.dart index 27078472b7..fa976c0851 100644 --- a/LanguageFeatures/nnbd/weak/static_errors_A14_t13.dart +++ b/LanguageFeatures/nnbd/weak/static_errors_A14_t13.dart @@ -15,6 +15,7 @@ /// @author sgrekhov@unipro.ru // Requirements=nnbd-weak + import "dart:async"; class A { @@ -25,11 +26,7 @@ main() { a?.toString(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?.' has type 'FutureOr' which excludes null. a ?.. toString(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?..' has type 'FutureOr' which excludes null. } diff --git a/LanguageFeatures/nnbd/weak/static_errors_A17_t03.dart b/LanguageFeatures/nnbd/weak/static_errors_A17_t03.dart index d71f3e490e..822b2200d7 100644 --- a/LanguageFeatures/nnbd/weak/static_errors_A17_t03.dart +++ b/LanguageFeatures/nnbd/weak/static_errors_A17_t03.dart @@ -21,32 +21,30 @@ main() { foo()?.toString(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?.runtimeType; // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?.s = 1; // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?..toString(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?..runtimeType; // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?..s = 1; // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'Never' which excludes null. } catch (_) {} } diff --git a/LanguageFeatures/nnbd/weak/static_errors_A17_t04.dart b/LanguageFeatures/nnbd/weak/static_errors_A17_t04.dart index dd9124c62a..fe9f0f0d6e 100644 --- a/LanguageFeatures/nnbd/weak/static_errors_A17_t04.dart +++ b/LanguageFeatures/nnbd/weak/static_errors_A17_t04.dart @@ -24,32 +24,30 @@ main() { foo()?.toString(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?.runtimeType; // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?.s = 1; // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?..toString(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?..runtimeType; // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'Never' which excludes null. + } catch (_) {} + try { foo()?..s = 1; // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?..' has type 'Never' which excludes null. } catch (_) {} } diff --git a/LanguageFeatures/nnbd/weak/static_errors_A32_t03.dart b/LanguageFeatures/nnbd/weak/static_errors_A32_t03.dart index f4113b7641..bb2ef547ae 100644 --- a/LanguageFeatures/nnbd/weak/static_errors_A32_t03.dart +++ b/LanguageFeatures/nnbd/weak/static_errors_A32_t03.dart @@ -11,6 +11,7 @@ /// @issue 39598 // Requirements=nnbd-weak + class A { test() {} } @@ -26,29 +27,19 @@ main() { a?.test(); // ^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?.' has type 'A' which excludes null. a?..test(); // ^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -//^ -// [cfe] Operand of null-aware operation '?..' has type 'A' which excludes null. a ?? c; // ^ // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION -//^ -// [cfe] Operand of null-aware operation '??' has type 'A' which excludes null. a ??= c; // ^ // [analyzer] STATIC_WARNING.DEAD_NULL_AWARE_EXPRESSION -//^ -// [cfe] Operand of null-aware operation '??=' has type 'A' which excludes null. List clist = [C(), C()]; List alist = [A(), C(), ...? clist]; // ^^^^ // [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '...?' has type 'List' which excludes null. } diff --git a/LanguageFeatures/nnbd/weak/syntax_A06_t01.dart b/LanguageFeatures/nnbd/weak/syntax_A06_t01.dart index c2743ee5d3..3c150c2008 100644 --- a/LanguageFeatures/nnbd/weak/syntax_A06_t01.dart +++ b/LanguageFeatures/nnbd/weak/syntax_A06_t01.dart @@ -24,9 +24,5 @@ main() { C? c = null; Expect.isNull(c?[42]); c = new C(); - Expect.equals(4, c?[2]); -// ^^ -// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR -// ^ -// [cfe] Operand of null-aware operation '?.' has type 'C' which excludes null. + Expect.equals(4, c?[2]); // ignore: invalid_null_aware_operator }