Fixes #988. Expect static type warning in a right way
diff --git a/LanguageFeatures/nnbd/weak/type-aliases/null_aware_operator_A17_t02.dart b/LanguageFeatures/nnbd/weak/type-aliases/null_aware_operator_A17_t02.dart
index 33fa687..68ea06f 100644
--- a/LanguageFeatures/nnbd/weak/type-aliases/null_aware_operator_A17_t02.dart
+++ b/LanguageFeatures/nnbd/weak/type-aliases/null_aware_operator_A17_t02.dart
@@ -41,17 +41,31 @@
main() {
CAlias1 c1 = new C();
- var actual1 = c1 ?.. test1; /// static type warning
+ var actual1 = c1 ?.. test1;
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+
var expected = c1;
Expect.equals(expected, actual1);
Expect.equals("test1 called 1 times, test2() called 0 times", c1.log);
- var actual2 = c1 ?.. test2(); /// static type warning
+ var actual2 = c1 ?.. test2();
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+
Expect.equals(expected, actual2);
Expect.equals("test1 called 1 times, test2() called 1 times", c1.log);
- var actual3 = c1 /// static type warning
+ var actual3 = c1
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
?.. test1
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
.. test2();
Expect.equals(expected, actual3);
Expect.equals("test1 called 2 times, test2() called 2 times", c1.log);
@@ -69,38 +83,75 @@
Expect.isNull(actual6);
c2 = new C();
- var actual7 = c2 ?.. test1; /// static type warning
+ var actual7 = c2 ?.. test1;
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
var expected2 = c2;
Expect.equals(expected2, actual7);
- Expect.equals("test1 called 1 times, test2() called 0 times", c2?.log); /// static type warning
+ 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(); /// static type warning
+ 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(expected2, actual8);
- Expect.equals("test1 called 1 times, test2() called 1 times", c2?.log); /// static type warning
+ 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.
- var actual9 = c2 /// static type warning
- ?.. test1
- .. test2();
+ var actual9 = c2
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+ ?.. test1
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ .. test2();
Expect.equals(expected2, actual9);
- Expect.equals("test1 called 2 times, test2() called 2 times", c2?.log); /// static type warning
-
+ 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.
CAlias2 c3 = new C();
- var actual10 = c3 ?.. test1; /// static type warning
+ var actual10 = c3 ?.. test1;
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
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(); /// static type warning
+ var actual11 = c3 ?.. test2();
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+
Expect.equals(expected3, actual11);
if (c3 != null) {
Expect.equals("test1 called 1 times, test2() called 1 times", c3.log);
}
- var actual12 = c3 /// static type warning
- ?.. test1
- .. test2();
+ var actual12 = c3
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+ ?.. test1
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+
+ .. test2();
Expect.equals(expected3, actual12);
if (c3 != null) {
Expect.equals("test1 called 2 times, test2() called 2 times", c3.log);
@@ -114,23 +165,49 @@
Expect.isNull(actual14);
var actual15 = c4
- ?.. test1
- .. test2();
+ ?.. test1
+ .. test2();
Expect.isNull(actual15);
c4 = new C();
- var actual16 = c4 ?.. test1; /// static type warning
+ var actual16 = c4 ?.. test1;
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+
var expected4 = c4;
Expect.equals(expected4, actual16);
- Expect.equals("test1 called 1 times, test2() called 0 times", c4?.log); /// static type warning
+ 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(); /// static type warning
+ 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(expected4, actual17);
- Expect.equals("test1 called 1 times, test2() called 1 times", c4?.log); /// static type warning
+ 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.
- var actual18 = c4 /// static type warning
- ?.. test1
- .. test2();
+ var actual18 = c4
+// ^
+// [cfe] Operand of null-aware operation '?..' has type 'C' which excludes null.
+ ?.. test1
+// ^^^
+// [analyzer] STATIC_WARNING.INVALID_NULL_AWARE_OPERATOR
+ .. test2();
Expect.equals(expected4, actual18);
- Expect.equals("test1 called 2 times, test2() called 2 times", c4?.log); /// static type warning
+ 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.
}