]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1384
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 16 Oct 2022 00:31:27 +0000 (17:31 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 16 Oct 2022 00:31:27 +0000 (17:31 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 5a19b930b74a03f998872ec87856b8512e78a13e..17a8504b30939be9826e371164af92abb45e0f0e 100644 (file)
@@ -10173,7 +10173,8 @@ $font_size
 
 
 ==> b1376.par <==
---add-trailing-commas='b'
+--add-trailing-commas
+--want-trailing-commas='b'
 --extended-line-up-parentheses
 --indent-columns=6
 --maximum-line-length=47
@@ -10245,6 +10246,33 @@ my $formatter = new HTML::FormatPS(
 --want-trailing-commas='b'
 --variable-maximum-line-length
 
+==> b1384.in <==
+    eval{
+        my@a=(foo=>'baz',bar=>'quux');
+        validate(@a,
+            {foo=>{regex=>qr/^baz$/},bar=>{regex=>'uqqx'}},
+        );
+    };
+
+    eval{
+        my@a=(foo=>'baz',bar=>'quux');
+        validate(@a,{foo=>{regex=>qr/^baz$/},bar=>{regex=>'uqqx'}});
+    };
+
+
+==> b1384.par <==
+--add-trailing-commas
+--noadd-whitespace
+--continuation-indentation=6
+--delete-old-whitespace
+--delete-trailing-commas
+--extended-continuation-indentation
+--ignore-old-breakpoints
+--maximum-line-length=65
+--paren-vertical-tightness-closing=2
+--variable-maximum-line-length
+--want-trailing-commas='m'
+
 ==> b1385.in <==
 (
     # optional glob
index 190297e719e6f4cd177d0cff10457f70dbe44172..4cb161cdc09a4a91c147123f992a625094b0da37 100644 (file)
@@ -8127,12 +8127,10 @@ sub match_trailing_comma_rule {
             $rLL_new );
     }
 
-    # Fix for b1379, b1380, b1381, b1382 part 1. Mark bare trailing commas for
-    # use by -vtc logic to avoid instability when -dtc and -atc are both
+    # Fix for b1379, b1380, b1381, b1382, b1384 part 1. Mark trailing commas
+    # for use by -vtc logic to avoid instability when -dtc and -atc are both
     # active.
-    if ( $match
-        && ( $trailing_comma_style eq 'b' || $trailing_comma_style eq 'h' ) )
-    {
+    if ($match) {
         if ( $if_add && $rOpts_delete_trailing_commas
             || !$if_add && $rOpts_add_trailing_commas )
         {
@@ -27574,10 +27572,11 @@ sub set_vertical_tightness_flags {
                 $cvt = 1;
             }
 
-            # Fix for b1379, b1380, b1381, b1382 part 2.
-            # Instablility with adding and deleting trailing bare commas.
-            # Reducing -cvt=2 to -cvt=1 fixes stability in b1379, b1380.
-            # Reducing -cvt>0 to -cvt=0 fixes stability in b1381, b1382.
+            # Fix for b1379, b1380, b1381, b1382, b1384 part 2,
+            # instablility with adding and deleting trailing commas:
+            # Reducing -cvt=2 to =1 fixes stability for -wtc=b in b1379,1380.
+            # Reducing -cvt>0 to =0 fixes stability for -wtc=b in b1381,1382.
+            # Reducing -cvt>0 to =0 fixes stability for -wtc=m in b1384
             if (   $cvt
                 && $self->[_ris_bare_trailing_comma_by_seqno_]->{$seqno} )
             {