Skip to content

Commit 8a54957

Browse files
MichaelRFairhurstcommit-bot@chromium.org
authored andcommitted
Clean up null aware access test
Change-Id: I893b4cea44278d114160331b69d06d92d0e56cf1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105735 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
1 parent c530c33 commit 8a54957

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

pkg/analyzer/test/src/diagnostics/unnecessary_null_aware_call_test.dart

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,17 @@ class UnnecessaryNullAwareCallTest extends DriverResolutionTest {
2323

2424
test_getter_parenthesized_nonNull() async {
2525
await assertErrorsInCode('''
26-
@pragma('analyzer:non-nullable')
27-
library foo;
28-
2926
f() {
3027
int x;
3128
(x)?.isEven;
3229
}
3330
''', [
34-
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 67, 2),
31+
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 20, 2),
3532
]);
3633
}
3734

3835
test_getter_parenthesized_nullable() async {
3936
await assertNoErrorsInCode('''
40-
@pragma('analyzer:non-nullable')
41-
library foo;
42-
4337
f() {
4438
int? x;
4539
(x)?.isEven;
@@ -49,23 +43,17 @@ f() {
4943

5044
test_getter_simple_nonNull() async {
5145
await assertErrorsInCode('''
52-
@pragma('analyzer:non-nullable')
53-
library foo;
54-
5546
f() {
5647
int x;
5748
x?.isEven;
5849
}
5950
''', [
60-
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 65, 2),
51+
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 18, 2),
6152
]);
6253
}
6354

6455
test_getter_simple_nullable() async {
6556
await assertNoErrorsInCode('''
66-
@pragma('analyzer:non-nullable')
67-
library foo;
68-
6957
f() {
7058
int? x;
7159
x?.isEven;
@@ -75,23 +63,17 @@ f() {
7563

7664
test_method_parenthesized_nonNull() async {
7765
await assertErrorsInCode('''
78-
@pragma('analyzer:non-nullable')
79-
library foo;
80-
8166
f() {
8267
int x;
8368
(x)?.round();
8469
}
8570
''', [
86-
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 67, 2),
71+
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 20, 2),
8772
]);
8873
}
8974

9075
test_method_parenthesized_nullable() async {
9176
await assertNoErrorsInCode('''
92-
@pragma('analyzer:non-nullable')
93-
library foo;
94-
9577
f() {
9678
int? x;
9779
(x)?.round();
@@ -101,23 +83,17 @@ f() {
10183

10284
test_method_simple_nonNull() async {
10385
await assertErrorsInCode('''
104-
@pragma('analyzer:non-nullable')
105-
library foo;
106-
10786
f() {
10887
int x;
10988
x?.round();
11089
}
11190
''', [
112-
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 65, 2),
91+
error(HintCode.UNNECESSARY_NULL_AWARE_CALL, 18, 2),
11392
]);
11493
}
11594

11695
test_method_simple_nullable() async {
11796
await assertNoErrorsInCode('''
118-
@pragma('analyzer:non-nullable')
119-
library foo;
120-
12197
f() {
12298
int? x;
12399
x?.round();

0 commit comments

Comments
 (0)