@@ -1393,6 +1393,69 @@ void f(A a, B b) {
1393
1393
''' );
1394
1394
}
1395
1395
1396
+ Future <void > test_classMethod_requiredNamed_remove () async {
1397
+ await _analyzeValidSelection (r'''
1398
+ class A {
1399
+ void ^test({
1400
+ required int a,
1401
+ required int b,
1402
+ required int c,
1403
+ }) {}
1404
+ }
1405
+
1406
+ class B extends A {
1407
+ void test({
1408
+ required int a,
1409
+ required int b,
1410
+ required int c,
1411
+ }) {}
1412
+ }
1413
+
1414
+ void f(A a, B b) {
1415
+ a.test(a: 0, b: 1, c: 2);
1416
+ b.test(a: 3, b: 4, c: 5);
1417
+ }
1418
+ ''' );
1419
+
1420
+ final signatureUpdate = MethodSignatureUpdate (
1421
+ formalParameters: [
1422
+ FormalParameterUpdate (
1423
+ id: 0 ,
1424
+ kind: FormalParameterKind .requiredNamed,
1425
+ ),
1426
+ FormalParameterUpdate (
1427
+ id: 2 ,
1428
+ kind: FormalParameterKind .requiredNamed,
1429
+ ),
1430
+ ],
1431
+ removedNamedFormalParameters: {'b' },
1432
+ formalParametersTrailingComma: TrailingComma .ifPresent,
1433
+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1434
+ );
1435
+
1436
+ await _assertUpdate (signatureUpdate, r'''
1437
+ >>>>>>> /home/test/lib/test.dart
1438
+ class A {
1439
+ void test({
1440
+ required int a,
1441
+ required int c,
1442
+ }) {}
1443
+ }
1444
+
1445
+ class B extends A {
1446
+ void test({
1447
+ required int a,
1448
+ required int c,
1449
+ }) {}
1450
+ }
1451
+
1452
+ void f(A a, B b) {
1453
+ a.test(a: 0, c: 2);
1454
+ b.test(a: 3, c: 5);
1455
+ }
1456
+ ''' );
1457
+ }
1458
+
1396
1459
Future <void > test_classMethod_requiredPositional_reorder () async {
1397
1460
await _analyzeValidSelection (r'''
1398
1461
class A {
@@ -1769,6 +1832,41 @@ void f() {
1769
1832
''' );
1770
1833
}
1771
1834
1835
+ Future <void > test_topFunction_optionalNamed_remove () async {
1836
+ await _analyzeValidSelection (r'''
1837
+ void ^test({int a, int b, int c}) {}
1838
+
1839
+ void f() {
1840
+ test(a: 0, b: 1, c: 2);
1841
+ }
1842
+ ''' );
1843
+
1844
+ final signatureUpdate = MethodSignatureUpdate (
1845
+ formalParameters: [
1846
+ FormalParameterUpdate (
1847
+ id: 0 ,
1848
+ kind: FormalParameterKind .optionalNamed,
1849
+ ),
1850
+ FormalParameterUpdate (
1851
+ id: 2 ,
1852
+ kind: FormalParameterKind .optionalNamed,
1853
+ ),
1854
+ ],
1855
+ removedNamedFormalParameters: {'b' },
1856
+ formalParametersTrailingComma: TrailingComma .ifPresent,
1857
+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1858
+ );
1859
+
1860
+ await _assertUpdate (signatureUpdate, r'''
1861
+ >>>>>>> /home/test/lib/test.dart
1862
+ void test({int a, int c}) {}
1863
+
1864
+ void f() {
1865
+ test(a: 0, c: 2);
1866
+ }
1867
+ ''' );
1868
+ }
1869
+
1772
1870
Future <void > test_topFunction_optionalNamed_reorder () async {
1773
1871
await _analyzeValidSelection (r'''
1774
1872
void ^test({
@@ -1994,6 +2092,40 @@ void f() {
1994
2092
''' );
1995
2093
}
1996
2094
2095
+ Future <void > test_topFunction_optionalPositional_remove () async {
2096
+ await _analyzeValidSelection (r'''
2097
+ void ^test([int? a, int? b, int? c]) {}
2098
+
2099
+ void f() {
2100
+ test(0, 1, 2);
2101
+ }
2102
+ ''' );
2103
+
2104
+ final signatureUpdate = MethodSignatureUpdate (
2105
+ formalParameters: [
2106
+ FormalParameterUpdate (
2107
+ id: 0 ,
2108
+ kind: FormalParameterKind .optionalPositional,
2109
+ ),
2110
+ FormalParameterUpdate (
2111
+ id: 2 ,
2112
+ kind: FormalParameterKind .optionalPositional,
2113
+ ),
2114
+ ],
2115
+ formalParametersTrailingComma: TrailingComma .ifPresent,
2116
+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
2117
+ );
2118
+
2119
+ await _assertUpdate (signatureUpdate, r'''
2120
+ >>>>>>> /home/test/lib/test.dart
2121
+ void test([int? a, int? c]) {}
2122
+
2123
+ void f() {
2124
+ test(0, 2);
2125
+ }
2126
+ ''' );
2127
+ }
2128
+
1997
2129
Future <void > test_topFunction_optionalPositional_reorder () async {
1998
2130
await _analyzeValidSelection (r'''
1999
2131
void ^test([int a, double b]) {}
@@ -2193,6 +2325,48 @@ ChangeStatusFailure
2193
2325
''' );
2194
2326
}
2195
2327
2328
+ Future <void > test_topFunction_requiredNamed_remove () async {
2329
+ await _analyzeValidSelection (r'''
2330
+ void ^test({
2331
+ required int a,
2332
+ required int b,
2333
+ required int c,
2334
+ }) {}
2335
+
2336
+ void f() {
2337
+ test(a: 0, b: 1, c: 2);
2338
+ }
2339
+ ''' );
2340
+
2341
+ final signatureUpdate = MethodSignatureUpdate (
2342
+ formalParameters: [
2343
+ FormalParameterUpdate (
2344
+ id: 0 ,
2345
+ kind: FormalParameterKind .requiredNamed,
2346
+ ),
2347
+ FormalParameterUpdate (
2348
+ id: 2 ,
2349
+ kind: FormalParameterKind .requiredNamed,
2350
+ ),
2351
+ ],
2352
+ removedNamedFormalParameters: {'b' },
2353
+ formalParametersTrailingComma: TrailingComma .ifPresent,
2354
+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
2355
+ );
2356
+
2357
+ await _assertUpdate (signatureUpdate, r'''
2358
+ >>>>>>> /home/test/lib/test.dart
2359
+ void test({
2360
+ required int a,
2361
+ required int c,
2362
+ }) {}
2363
+
2364
+ void f() {
2365
+ test(a: 0, c: 2);
2366
+ }
2367
+ ''' );
2368
+ }
2369
+
2196
2370
Future <void > test_topFunction_requiredNamed_reorder () async {
2197
2371
await _analyzeValidSelection (r'''
2198
2372
void ^test({
@@ -2387,6 +2561,40 @@ void f() {
2387
2561
''' );
2388
2562
}
2389
2563
2564
+ Future <void > test_topFunction_requiredPositional_remove () async {
2565
+ await _analyzeValidSelection (r'''
2566
+ void ^test(int a, int b, int c) {}
2567
+
2568
+ void f() {
2569
+ test(0, 1, 2);
2570
+ }
2571
+ ''' );
2572
+
2573
+ final signatureUpdate = MethodSignatureUpdate (
2574
+ formalParameters: [
2575
+ FormalParameterUpdate (
2576
+ id: 0 ,
2577
+ kind: FormalParameterKind .requiredPositional,
2578
+ ),
2579
+ FormalParameterUpdate (
2580
+ id: 2 ,
2581
+ kind: FormalParameterKind .requiredPositional,
2582
+ ),
2583
+ ],
2584
+ formalParametersTrailingComma: TrailingComma .ifPresent,
2585
+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
2586
+ );
2587
+
2588
+ await _assertUpdate (signatureUpdate, r'''
2589
+ >>>>>>> /home/test/lib/test.dart
2590
+ void test(int a, int c) {}
2591
+
2592
+ void f() {
2593
+ test(0, 2);
2594
+ }
2595
+ ''' );
2596
+ }
2597
+
2390
2598
Future <void > test_topFunction_requiredPositional_reorder () async {
2391
2599
await _analyzeValidSelection (r'''
2392
2600
void ^test(int a, double b) {}
0 commit comments