@@ -18,7 +18,7 @@ class AvoidRedundantArgumentValuesNamedArgsAnywhereTest extends LintRuleTest {
1818 @override
1919 String get lintRule => LintNames .avoid_redundant_argument_values;
2020
21- test_namedArgumentBeforePositional () async {
21+ Future < void > test_namedArgumentBeforePositional () async {
2222 await assertDiagnostics (
2323 r'''
2424void foo(int a, int b, {bool c = true}) {}
@@ -37,7 +37,30 @@ class AvoidRedundantArgumentValuesTest extends LintRuleTest {
3737 @override
3838 String get lintRule => LintNames .avoid_redundant_argument_values;
3939
40- test_constructor_redundant () async {
40+ Future <void > test_annotation () async {
41+ await assertNoDiagnostics (r'''
42+ @A(p: false)
43+ class A {
44+ final bool p;
45+ const A({this.p = true});
46+ }
47+ ''' );
48+ }
49+
50+ Future <void > test_annotation_redundant () async {
51+ await assertDiagnostics (
52+ r'''
53+ @A(p: true)
54+ class A {
55+ final bool p;
56+ const A({this.p = true});
57+ }
58+ ''' ,
59+ [lint (6 , 4 )],
60+ );
61+ }
62+
63+ Future <void > test_constructor_redundant () async {
4164 await assertDiagnostics (
4265 r'''
4366void f() {
@@ -51,7 +74,7 @@ class A {
5174 );
5275 }
5376
54- test_constructor_tearoff_redundant () async {
77+ Future < void > test_constructor_tearoff_redundant () async {
5578 await assertDiagnostics (
5679 r'''
5780void f() {
@@ -67,7 +90,7 @@ class A {
6790 }
6891
6992 /// https://github.com/dart-lang/linter/issues/3617
70- test_enumDeclaration () async {
93+ Future < void > test_enumDeclaration () async {
7194 await assertDiagnostics (
7295 r'''
7396enum TestEnum {
@@ -83,7 +106,7 @@ enum TestEnum {
83106 }
84107
85108 @FailingTest (issue: 'https://github.com/dart-lang/linter/issues/3447' )
86- test_fromEnvironment () async {
109+ Future < void > test_fromEnvironment () async {
87110 await assertNoDiagnostics (r'''
88111const bool someDefine = bool.fromEnvironment('someDefine');
89112
@@ -97,7 +120,7 @@ void g() {
97120''' );
98121 }
99122
100- test_function_optionalPositional_followedByPositional () async {
123+ Future < void > test_function_optionalPositional_followedByPositional () async {
101124 await assertNoDiagnostics (r'''
102125void f() {
103126 g(0, 1);
@@ -106,7 +129,7 @@ void g([int a = 0, int? b]) {}
106129''' );
107130 }
108131
109- test_function_optionalPositional_subsequent_different () async {
132+ Future < void > test_function_optionalPositional_subsequent_different () async {
110133 await assertNoDiagnostics (r'''
111134void f() {
112135 g(0, 2);
@@ -115,7 +138,7 @@ void g([int? a, int? b = 1]) {}
115138''' );
116139 }
117140
118- test_function_optionalPositional_subsequent_redundant () async {
141+ Future < void > test_function_optionalPositional_subsequent_redundant () async {
119142 await assertDiagnostics (
120143 r'''
121144void f() {
@@ -127,7 +150,7 @@ void g([int? a, int? b = 1]) {}
127150 );
128151 }
129152
130- test_localFunction_optionalNamed_different () async {
153+ Future < void > test_localFunction_optionalNamed_different () async {
131154 await assertNoDiagnostics (r'''
132155void f() {
133156 void g({bool p = true}) {}
@@ -136,7 +159,7 @@ void f() {
136159''' );
137160 }
138161
139- test_localFunction_optionalNamed_redundant () async {
162+ Future < void > test_localFunction_optionalNamed_redundant () async {
140163 await assertDiagnostics (
141164 r'''
142165void f() {
@@ -148,7 +171,7 @@ void f() {
148171 );
149172 }
150173
151- test_method_noDefault () async {
174+ Future < void > test_method_noDefault () async {
152175 await assertNoDiagnostics (r'''
153176void f(A a) {
154177 a.g(p: false);
@@ -159,7 +182,7 @@ class A {
159182''' );
160183 }
161184
162- test_method_optionalNamed_variable () async {
185+ Future < void > test_method_optionalNamed_variable () async {
163186 await assertNoDiagnostics (r'''
164187void f(A a, bool v) {
165188 a.g(p: v);
@@ -170,7 +193,7 @@ class A {
170193''' );
171194 }
172195
173- test_method_redundant () async {
196+ Future < void > test_method_redundant () async {
174197 await assertDiagnostics (
175198 r'''
176199void f(A a) {
@@ -184,7 +207,7 @@ class A {
184207 );
185208 }
186209
187- test_redirectingFactoryConstructor () async {
210+ Future < void > test_redirectingFactoryConstructor () async {
188211 await assertNoDiagnostics (r'''
189212class A {
190213 factory A([int? value]) = B;
@@ -201,7 +224,7 @@ void f() {
201224''' );
202225 }
203226
204- test_redirectingFactoryConstructor_cyclic () async {
227+ Future < void > test_redirectingFactoryConstructor_cyclic () async {
205228 await assertDiagnostics (
206229 r'''
207230class A {
@@ -220,7 +243,7 @@ void f() {
220243 );
221244 }
222245
223- test_redirectingFactoryConstructor_multipleOptional () async {
246+ Future < void > test_redirectingFactoryConstructor_multipleOptional () async {
224247 await assertNoDiagnostics (r'''
225248class A {
226249 factory A([int? one, int? two]) = B;
@@ -239,7 +262,7 @@ void f() {
239262''' );
240263 }
241264
242- test_redirectingFactoryConstructor_named () async {
265+ Future < void > test_redirectingFactoryConstructor_named () async {
243266 await assertNoDiagnostics (r'''
244267class A {
245268 factory A({int? value}) = B;
@@ -256,7 +279,7 @@ void f() {
256279''' );
257280 }
258281
259- test_redirectingFactoryConstructor_named_redundant () async {
282+ Future < void > test_redirectingFactoryConstructor_named_redundant () async {
260283 await assertDiagnostics (
261284 r'''
262285class A {
@@ -274,6 +297,7 @@ void f() {
274297 );
275298 }
276299
300+ Future <void >
277301 test_redirectingFactoryConstructor_namedArgumentsAnywhere () async {
278302 await assertNoDiagnostics (r'''
279303class A {
@@ -293,6 +317,7 @@ void f() {
293317''' );
294318 }
295319
320+ Future <void >
296321 test_redirectingFactoryConstructor_namedArgumentsAnywhere_redundant () async {
297322 await assertDiagnostics (
298323 r'''
@@ -311,7 +336,7 @@ void f() {
311336 );
312337 }
313338
314- test_redirectingFactoryConstructor_nested () async {
339+ Future < void > test_redirectingFactoryConstructor_nested () async {
315340 await assertNoDiagnostics (r'''
316341class A {
317342 factory A([num? value]) = B;
@@ -336,7 +361,7 @@ void f() {
336361''' );
337362 }
338363
339- test_redirectingFactoryConstructor_redundant () async {
364+ Future < void > test_redirectingFactoryConstructor_redundant () async {
340365 await assertDiagnostics (
341366 r'''
342367class A {
@@ -354,7 +379,7 @@ void f() {
354379 );
355380 }
356381
357- test_redirectingGenerativeConstructor () async {
382+ Future < void > test_redirectingGenerativeConstructor () async {
358383 await assertNoDiagnostics (r'''
359384class A {
360385 A([int? value]) : this._(value);
@@ -366,7 +391,7 @@ void f() {
366391''' );
367392 }
368393
369- test_redirectingGenerativeConstructor_named () async {
394+ Future < void > test_redirectingGenerativeConstructor_named () async {
370395 await assertNoDiagnostics (r'''
371396class A {
372397 A({int? value}) : this._(value: value);
@@ -378,7 +403,7 @@ void f() {
378403''' );
379404 }
380405
381- test_redirectingGenerativeConstructor_named_redundant () async {
406+ Future < void > test_redirectingGenerativeConstructor_named_redundant () async {
382407 await assertDiagnostics (
383408 r'''
384409class A {
@@ -393,7 +418,7 @@ void f() {
393418 );
394419 }
395420
396- test_redirectingGenerativeConstructor_redundant () async {
421+ Future < void > test_redirectingGenerativeConstructor_redundant () async {
397422 await assertDiagnostics (
398423 r'''
399424class A {
@@ -408,7 +433,7 @@ void f() {
408433 );
409434 }
410435
411- test_requiredNullable () async {
436+ Future < void > test_requiredNullable () async {
412437 await assertNoDiagnostics (r'''
413438void f({required int? x}) { }
414439
@@ -419,7 +444,7 @@ void main() {
419444 }
420445
421446 @FailingTest (issue: 'https://github.com/dart-lang/linter/issues/4967' )
422- test_toListOptionalGrowable () async {
447+ Future < void > test_toListOptionalGrowable () async {
423448 await assertDiagnostics (
424449 r'''
425450void main() {
0 commit comments