Skip to content

Commit ae74b46

Browse files
authored
Fixes #1837. Add additional unnecessary null-ckeck warnings (#1842)
1 parent 0230e6a commit ae74b46

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

LanguageFeatures/Patterns/null_check_A02_t01.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ String test1(int? x) {
2323
// [cfe] The null-check pattern will have no effect because the matched type isn't nullable.
2424
return "match-1";
2525
case int v2?:
26+
// ^
27+
// [analyzer] STATIC_WARNING.UNNECESSARY_NULL_CHECK_PATTERN
28+
// [cfe] The null-check pattern will have no effect because the matched type isn't nullable.
2629
return "match-2";
2730
default:
2831
return "no match";
@@ -37,6 +40,9 @@ String test2(int? x) {
3740
return "match-2";
3841
}
3942
if (x case int v2?) {
43+
// ^
44+
// [analyzer] STATIC_WARNING.UNNECESSARY_NULL_CHECK_PATTERN
45+
// [cfe] The null-check pattern will have no effect because the matched type isn't nullable.
4046
return "match-2";
4147
}
4248
return "no match";
@@ -49,6 +55,9 @@ String test3(int? x) =>
4955
// [analyzer] STATIC_WARNING.UNNECESSARY_NULL_CHECK_PATTERN
5056
// [cfe] The null-check pattern will have no effect because the matched type isn't nullable.
5157
int v2? => "match-2",
58+
// ^
59+
// [analyzer] STATIC_WARNING.UNNECESSARY_NULL_CHECK_PATTERN
60+
// [cfe] The null-check pattern will have no effect because the matched type isn't nullable.
5261
_ => "no match"
5362
};
5463

0 commit comments

Comments
 (0)