@@ -290,6 +290,26 @@ class C {
290290 );
291291 }
292292
293+ test_argumentOmitted_redirectedConstructor_indirectlyDeprecated () async {
294+ // This test asserts that we do _not_ report the `C.three` constructor.
295+ // While the `C.two` constructor must deal with the deprecation of the
296+ // optionality of `C.new`'s `p` parameter, there is nothing to do for
297+ // `C.three`. (For example, we can't pass a positional argument to
298+ // `this.two()`, because `C.two` does not accept a positional parameter.)
299+ // Whether and how `C.three` must change depends on how `C.two` is changed
300+ // to handle the deprecation.
301+ await assertErrorsInCode (
302+ r'''
303+ class C {
304+ C([@Deprecated.optional() int? p]);
305+ C.two() : this();
306+ C.three() : this.two();
307+ }
308+ ''' ,
309+ [error (WarningCode .deprecatedOptional, 60 , 4 )],
310+ );
311+ }
312+
293313 test_argumentOmitted_redirectedConstructor_named () async {
294314 await assertErrorsInCode (
295315 r'''
@@ -378,6 +398,31 @@ class D extends C {
378398 );
379399 }
380400
401+ test_argumentOmitted_superInvocation_indirectlyDeprecated () async {
402+ // This test asserts that we do _not_ report the `E.new` constructor. While
403+ // the `D.new` constructor must deal with the deprecation of the optionality
404+ // of `C.new`'s `p` parameter, there is nothing to do for `E.new`. (For
405+ // example, we can't pass a positional argument to `super()`, because
406+ // `D.new` does not accept a positional parameter.) Whether and how `E.new`
407+ // must change depends on how `D.new` is changed to handle the deprecation.
408+ await assertErrorsInCode (
409+ r'''
410+ class C {
411+ C([@Deprecated.optional() int? p]);
412+ }
413+
414+ class D extends C {
415+ D() : super();
416+ }
417+
418+ class E extends D {
419+ E() : super();
420+ }
421+ ''' ,
422+ [error (WarningCode .deprecatedOptional, 79 , 5 )],
423+ );
424+ }
425+
381426 test_argumentOmitted_superInvocation_namedParameter () async {
382427 await assertErrorsInCode (
383428 r'''
0 commit comments