]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1468
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 21 Apr 2024 22:11:48 +0000 (15:11 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 21 Apr 2024 22:11:48 +0000 (15:11 -0700)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index 3e9556ead8fb2e349a377ec88221ddfdc30d9825..04663be9b421710a6e80c638d989cf4f25ad9514 100644 (file)
@@ -12044,6 +12044,37 @@ sub new{
 --square-bracket-tightness=2
 --brace-vertical-tightness=1
 
+==> b1468.in <==
+foreach $n (
+     qw( msm ali ) )
+{    foreach $e ( qw(
+          uc16
+          ) )
+     {
+          #
+     }
+}
+
+foreach $n (
+     qw( msm ali ) )
+{
+     foreach $e ( qw(
+          uc16
+     ) )
+     {
+          #
+     }
+}
+
+==> b1468.par <==
+--maximum-line-length=21
+--indent-columns=5
+--weld-nested-containers
+--paren-vertical-tightness-closing=2
+--stack-opening-paren
+--block-brace-vertical-tightness=1
+--nodelete-old-newlines
+
 ==> b148.in <==
 # state 1
 @yydgoto=(
index b697fe65567bfe9c8639b790a3272d7146822ff6..cbad2352d0d2826b2068541bfdc8fb82efa6e8bd 100644 (file)
@@ -8167,6 +8167,27 @@ sub new{
                   transmit => 2,
             }];
 
+==> b1468 <==
+foreach $n (
+     qw( msm ali ) )
+{    foreach $e ( qw(
+          uc16
+          ) )
+     {
+          #
+     }
+}
+
+foreach $n (
+     qw( msm ali ) )
+{    foreach $e ( qw(
+          uc16
+          ) )
+     {
+          #
+     }
+}
+
 ==> b148 <==
 # state 1
 @yydgoto=(
index 626b13962b268464c7b0d9e4419791a20a56b56e..8a21ffa7656f960d1976d16d4f99c1d9dd273551 100644 (file)
@@ -14681,7 +14681,7 @@ sub cross_check_call_args {
 
                 # Skip the warning for small lists with undercount
                 if (   $ris_mismatched_call_type->{'u'}
-                    && $shift_count >= $mismatched_arg_undercount_cutoff )
+                    && $shift_count > $mismatched_arg_undercount_cutoff )
                 {
                     my $lines_under_count = stringify_line_range($runder_count);
                     my $total             = $num_direct + $num_self;
@@ -15787,6 +15787,26 @@ sub setup_new_weld_measurements {
         }
     }
 
+    # fix c1468 - do not measure from a leading opening block brace -
+    # which is not a one-line block
+    if (   $Kref < $Kouter_opening
+        && $Kref == $Kfirst
+        && $rLL->[$Kref]->[_TOKEN_] eq '{' )
+    {
+        my $seqno_ref = $rLL->[$Kref]->[_TYPE_SEQUENCE_];
+        if ($seqno_ref) {
+            my $block_type = $self->[_rblock_type_of_seqno_]->{$seqno_ref};
+            if ($block_type) {
+                my $Kref_c   = $self->[_K_closing_container_]->{$seqno_ref};
+                my $ln_ref_o = $rLL->[$Kref]->[_LINE_INDEX_];
+                my $ln_ref_c = $rLL->[$Kref_c]->[_LINE_INDEX_];
+                if ( $ln_ref_c > $ln_ref_o ) {
+                    $Kref = $self->K_next_nonblank($Kref);
+                }
+            }
+        }
+    }
+
     # Define the starting measurements we will need
     $starting_lentot =
       $Kref <= 0 ? 0 : $rLL->[ $Kref - 1 ]->[_CUMULATIVE_LENGTH_];