]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix c161, b1424, 1425
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 5 Nov 2022 13:31:38 +0000 (06:31 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 5 Nov 2022 13:31:38 +0000 (06:31 -0700)
This simplifies code which gives priority to -wn over -pvt when both might apply

CHANGES.md
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 22b28f8522443005bd2bd9f337f7237941a0592b..a26f46d54c11a140bdd0596fad2bf749152735e4 100644 (file)
@@ -70,8 +70,8 @@
       Also, previously a word following a '->' was given the color of a bareword,
       black by default, but now it is given the color of an identifier.
 
-    - Fixed incorrect formatting of any function named 'err'.  This was
-      due to some old code when use feature 'err' was valid.
+    - Fixed incorrect indentation of any function named 'err'.  This was
+      due to some old code from when "use feature 'err'" was valid.
 
             # OLD:
             my ($curr) = current();
@@ -82,8 +82,7 @@
             err(@_);
 
     - Added parameter --delete-repeated-commas (-drc) to delete repeated
-      commas. This is off by default. I added this option after discovering
-      an unwanted repeated comma in the perltidy source. For example, given:
+      commas. This is off by default. For example, given:
 
             ignoreSpec( $file, "file",, \%spec, \%Rspec );
 
       This will change some existing formatting.
 
     - The following new parameters are available for manipulating
-      trailing commas. They are described in the manual.
+      trailing commas of lists. They are described in the manual.
 
            --want-trailing-commas=s, -wtc=s
            --add-trailing-commas,    -atc
index 3ff688645058a22f7d60e0fb0d0a9a3dc84cbd55..253ea427ed27145dfc9495c87a2689485ad7b521 100644 (file)
@@ -10873,6 +10873,64 @@ L2hos
 --paren-vertical-tightness=1
 --weld-nested-containers
 
+==> b1424.in <==
+$registry->add_type_constraint( Moose::Meta::TypeConstraint::Parameterizable
+                                  ->new( $a = 1;
+                                         $b = 1;
+
+                                  ) );
+
+$registry->add_type_constraint(
+                                Moose::Meta::TypeConstraint::Parameterizable
+                                  ->new( $a = 1;
+                                         $b = 1;
+
+                                  ) );
+
+
+==> b1424.par <==
+--extended-line-up-parentheses
+--indent-columns=8
+--keep-old-breakpoints-after='q >= - w ; <> ** & ? !='
+--stack-closing-paren
+--vertical-tightness=1
+--weld-nested-containers
+
+==> b1425.in <==
+my$sem=sub
+{
+    my$code=shift;
+  }
+  ->(sub
+     {
+         IPC::Semaphore->new(IPC_PRIVATE,$nsem,
+                           S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
+     } );
+
+my$sem=sub
+{
+    my$code=shift;
+  }
+  ->(
+     sub
+     {
+         IPC::Semaphore->new(IPC_PRIVATE,$nsem,
+                           S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
+     } );
+
+
+==> b1425.par <==
+--noadd-whitespace
+--delete-old-whitespace
+--extended-line-up-parentheses
+--ignore-old-breakpoints
+--maximum-line-length=51
+--opening-anonymous-sub-brace-on-new-line
+--paren-vertical-tightness-closing=2
+--paren-vertical-tightness=1
+--variable-maximum-line-length
+--weld-nested-containers
+
 ==> b146.in <==
 # State 1
 
index b9b420d9583cb7f85f9543d40b7af6681ad3ab06..e8756acb4a976b50d190a0161c299cad255b782f 100644 (file)
@@ -9994,19 +9994,16 @@ sub weld_nested_containers {
         }
         next if ($do_not_weld_rule);
 
-        # Turn off vertical tightness completely at possible one-line welds.
-        # Fixes b1402.  This also fixes issues b1338, b1339, b1340, b1341,
-        # b1342, b1343, but both fixes are needed in general for good
-        # protection against instability.  The line difference of '2'
-        # worked for b1402, but needs to be '3' to include b1419 because
-        # it has -vtc>0 which can add more uncertainty.
-        # And for case b1421 it had to be increased to '4'.
+        # Turn off vertical tightness at possible one-line welds.  Fixes
+        # b1402,b1419,b1421,b1424,b1425. This also fixes issues b1338, b1339,
+        # b1340, b1341, b1342, b1343, but both fixes are needed in general for
+        # good protection against instability.  Issue c161 is the latest and
+        # simplest check, using $iline_ic==$iline_io as the test.
         if (   %opening_vertical_tightness
+            && $iline_ic == $iline_io
             && $opening_vertical_tightness{$token_oo} )
         {
-            if ( $iline_oc - $iline_oo <= 4 ) {
-                $rmax_vertical_tightness->{$outer_seqno} = 0;
-            }
+            $rmax_vertical_tightness->{$outer_seqno} = 0;
         }
 
         my $is_multiline_weld =
@@ -12112,7 +12109,6 @@ sub xlp_collapsed_lengths {
                         && $seqno_end == $rLL->[$Kc_test]->[_TYPE_SEQUENCE_]
                         && $rLL->[$Kc_test]->[_LINE_INDEX_] == $iline + 1 )
                     {
-                        my $Kc_test = $rLL->[$K_terminal]->[_KNEXT_SEQ_ITEM_];
                         my $line_of_tokens_next = $rlines->[ $iline + 1 ];
                         my $rtype_count = $rtype_count_by_seqno->{$seqno_end};
                         my $comma_count =