@@ -1599,6 +1599,186 @@ ChangeStatusFailure
15991599''' );
16001600 }
16011601
1602+ Future <void >
1603+ test_formalParametersTrailingComma_requiredNamed_always_add () async {
1604+ await _analyzeValidSelection (r'''
1605+ void ^test({required int a, required int b}) {}
1606+ ''' );
1607+
1608+ final signatureUpdate = MethodSignatureUpdate (
1609+ formalParameters: [
1610+ FormalParameterUpdate (
1611+ id: 1 ,
1612+ kind: FormalParameterKind .requiredNamed,
1613+ ),
1614+ FormalParameterUpdate (
1615+ id: 0 ,
1616+ kind: FormalParameterKind .requiredNamed,
1617+ ),
1618+ ],
1619+ formalParametersTrailingComma: TrailingComma .always,
1620+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1621+ );
1622+
1623+ await _assertUpdate (signatureUpdate, r'''
1624+ >>>>>>> /home/test/lib/test.dart
1625+ void test({
1626+ required int b,
1627+ required int a,
1628+ }) {}
1629+ ''' );
1630+ }
1631+
1632+ Future <void >
1633+ test_formalParametersTrailingComma_requiredNamed_ifPresent_false () async {
1634+ await _analyzeValidSelection (r'''
1635+ void ^test({required int a, required int b}) {}
1636+ ''' );
1637+
1638+ final signatureUpdate = MethodSignatureUpdate (
1639+ formalParameters: [
1640+ FormalParameterUpdate (
1641+ id: 1 ,
1642+ kind: FormalParameterKind .requiredNamed,
1643+ ),
1644+ FormalParameterUpdate (
1645+ id: 0 ,
1646+ kind: FormalParameterKind .requiredNamed,
1647+ ),
1648+ ],
1649+ formalParametersTrailingComma: TrailingComma .ifPresent,
1650+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1651+ );
1652+
1653+ await _assertUpdate (signatureUpdate, r'''
1654+ >>>>>>> /home/test/lib/test.dart
1655+ void test({required int b, required int a}) {}
1656+ ''' );
1657+ }
1658+
1659+ Future <void >
1660+ test_formalParametersTrailingComma_requiredNamed_ifPresent_true () async {
1661+ await _analyzeValidSelection (r'''
1662+ void ^test({
1663+ required int a,
1664+ required int b,
1665+ }) {}
1666+ ''' );
1667+
1668+ final signatureUpdate = MethodSignatureUpdate (
1669+ formalParameters: [
1670+ FormalParameterUpdate (
1671+ id: 1 ,
1672+ kind: FormalParameterKind .requiredNamed,
1673+ ),
1674+ FormalParameterUpdate (
1675+ id: 0 ,
1676+ kind: FormalParameterKind .requiredNamed,
1677+ ),
1678+ ],
1679+ formalParametersTrailingComma: TrailingComma .ifPresent,
1680+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1681+ );
1682+
1683+ await _assertUpdate (signatureUpdate, r'''
1684+ >>>>>>> /home/test/lib/test.dart
1685+ void test({
1686+ required int b,
1687+ required int a,
1688+ }) {}
1689+ ''' );
1690+ }
1691+
1692+ Future <void >
1693+ test_formalParametersTrailingComma_requiredNamed_never_remove () async {
1694+ await _analyzeValidSelection (r'''
1695+ void ^test({
1696+ required int b,
1697+ required int a,
1698+ }) {}
1699+ ''' );
1700+
1701+ final signatureUpdate = MethodSignatureUpdate (
1702+ formalParameters: [
1703+ FormalParameterUpdate (
1704+ id: 1 ,
1705+ kind: FormalParameterKind .requiredNamed,
1706+ ),
1707+ FormalParameterUpdate (
1708+ id: 0 ,
1709+ kind: FormalParameterKind .requiredNamed,
1710+ ),
1711+ ],
1712+ formalParametersTrailingComma: TrailingComma .never,
1713+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1714+ );
1715+
1716+ await _assertUpdate (signatureUpdate, r'''
1717+ >>>>>>> /home/test/lib/test.dart
1718+ void test({required int a, required int b}) {}
1719+ ''' );
1720+ }
1721+
1722+ Future <void >
1723+ test_formalParametersTrailingComma_requiredPositional_always_add () async {
1724+ await _analyzeValidSelection (r'''
1725+ void ^test(int a, int b) {}
1726+ ''' );
1727+
1728+ final signatureUpdate = MethodSignatureUpdate (
1729+ formalParameters: [
1730+ FormalParameterUpdate (
1731+ id: 1 ,
1732+ kind: FormalParameterKind .requiredPositional,
1733+ ),
1734+ FormalParameterUpdate (
1735+ id: 0 ,
1736+ kind: FormalParameterKind .requiredPositional,
1737+ ),
1738+ ],
1739+ formalParametersTrailingComma: TrailingComma .always,
1740+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1741+ );
1742+
1743+ await _assertUpdate (signatureUpdate, r'''
1744+ >>>>>>> /home/test/lib/test.dart
1745+ void test(
1746+ int b,
1747+ int a,
1748+ ) {}
1749+ ''' );
1750+ }
1751+
1752+ Future <void >
1753+ test_formalParametersTrailingComma_requiredPositional_never_remove () async {
1754+ await _analyzeValidSelection (r'''
1755+ void ^test(
1756+ int a,
1757+ int b,
1758+ ) {}
1759+ ''' );
1760+
1761+ final signatureUpdate = MethodSignatureUpdate (
1762+ formalParameters: [
1763+ FormalParameterUpdate (
1764+ id: 1 ,
1765+ kind: FormalParameterKind .requiredPositional,
1766+ ),
1767+ FormalParameterUpdate (
1768+ id: 0 ,
1769+ kind: FormalParameterKind .requiredPositional,
1770+ ),
1771+ ],
1772+ formalParametersTrailingComma: TrailingComma .never,
1773+ argumentsTrailingComma: ArgumentsTrailingComma .ifPresent,
1774+ );
1775+
1776+ await _assertUpdate (signatureUpdate, r'''
1777+ >>>>>>> /home/test/lib/test.dart
1778+ void test(int b, int a) {}
1779+ ''' );
1780+ }
1781+
16021782 Future <void > test_topFunction_fail_noSuchId_greater () async {
16031783 await _analyzeValidSelection (r'''
16041784void ^test(int a) {}
@@ -2326,6 +2506,34 @@ ChangeStatusFailure
23262506''' );
23272507 }
23282508
2509+ Future <void > test_topFunction_requiredNamed_remove_all () async {
2510+ await _analyzeValidSelection (r'''
2511+ void ^test({
2512+ required int a,
2513+ }) {}
2514+
2515+ void f() {
2516+ test(a: 0);
2517+ }
2518+ ''' );
2519+
2520+ final signatureUpdate = MethodSignatureUpdate (
2521+ formalParameters: [],
2522+ removedNamedFormalParameters: {'a' },
2523+ formalParametersTrailingComma: TrailingComma .always,
2524+ argumentsTrailingComma: ArgumentsTrailingComma .always,
2525+ );
2526+
2527+ await _assertUpdate (signatureUpdate, r'''
2528+ >>>>>>> /home/test/lib/test.dart
2529+ void test() {}
2530+
2531+ void f() {
2532+ test();
2533+ }
2534+ ''' );
2535+ }
2536+
23292537 Future <void > test_topFunction_requiredNamed_remove_first () async {
23302538 await _analyzeValidSelection (r'''
23312539void ^test({
@@ -2646,6 +2854,31 @@ void f() {
26462854''' );
26472855 }
26482856
2857+ Future <void > test_topFunction_requiredPositional_remove_all () async {
2858+ await _analyzeValidSelection (r'''
2859+ void ^test(int a) {}
2860+
2861+ void f() {
2862+ test(0);
2863+ }
2864+ ''' );
2865+
2866+ final signatureUpdate = MethodSignatureUpdate (
2867+ formalParameters: [],
2868+ formalParametersTrailingComma: TrailingComma .always,
2869+ argumentsTrailingComma: ArgumentsTrailingComma .always,
2870+ );
2871+
2872+ await _assertUpdate (signatureUpdate, r'''
2873+ >>>>>>> /home/test/lib/test.dart
2874+ void test() {}
2875+
2876+ void f() {
2877+ test();
2878+ }
2879+ ''' );
2880+ }
2881+
26492882 Future <void > test_topFunction_requiredPositional_remove_first () async {
26502883 await _analyzeValidSelection (r'''
26512884void ^test(int a, int b, int c) {}
0 commit comments