]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix case b1460
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 21 Sep 2023 15:07:38 +0000 (08:07 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 21 Sep 2023 15:07:38 +0000 (08:07 -0700)
dev-bin/perltidy_random_setup.pl
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index aa44a5b39635e6fcc9ba41415acb2e55148ae923..92443d64b86fc126849e1747de734b46a7b7828d 100755 (executable)
@@ -1306,8 +1306,14 @@ EOM
           code-skipping-begin
           code-skipping-end
           line-range-tidy
+
+          vertical-tightness
+          vertical-tightness-closing
         );
 
+        # Added vertical-tightness and vertical-tightness-closing because
+        # they are expansions. They should not be among the options. (c271)
+
         my %skip;
         @skip{@q} = (1) x scalar(@q);
 
index 18e6388a5b651cb9973052d993e9a583ab47a628..a041480adca245ea31197c28167e5b795782877b 100644 (file)
@@ -11790,6 +11790,33 @@ sub bubba {
 --vertical-tightness=2
 --weld-nested-containers
 
+==> b1460.in <==
+# S1;
+  diag "Connected to "
+        . inet_ntoa (( unpack_sockaddr_in (
+                            getpeername (T)
+                     ) )[1] ) . "\n" ;
+
+# S2
+  diag "Connected to "
+        . inet_ntoa (
+                      (unpack_sockaddr_in (
+                            getpeername (T)
+                       )
+                      )[1] ) . "\n" ;
+
+
+==> b1460.par <==
+--continuation-indentation=6
+--extended-line-up-parentheses
+--indent-columns=1
+--maximum-line-length=43
+--space-function-paren
+--stack-closing-paren
+--stack-opening-paren
+--vertical-tightness=2
+--weld-nested-containers
+
 ==> b148.in <==
 # state 1
 @yydgoto=(
index 5a8ec0e009a901b27daf0a8fb922bf7912d4f293..615c743f8eefa39e3ade518a18225f42ac08ee27 100644 (file)
@@ -1162,7 +1162,8 @@ my ( $template, $borrowernumber, $cookie ) =
 ==> b1020 <==
 # S1
 {
- return(self->_testStrand($other,$so)and not((
+ return(
+        self->_testStrand($other,$so)and not((
                   $self->start()>$other->end()
                 or$self->end()<$other->start()
         ))
@@ -7977,6 +7978,22 @@ sub bubba {
                   exec_stmt ( $i_cond->[ 1 ] );
         } } }
 
+==> b1460 <==
+  # S1;
+  diag "Connected to "
+        . inet_ntoa (
+                     ( unpack_sockaddr_in (
+                             getpeername(T)
+                     ) )[1] ) . "\n";
+
+  # S2
+  diag "Connected to "
+        . inet_ntoa (
+                     ( unpack_sockaddr_in (
+                             getpeername(T)
+                     ) )[1] ) . "\n";
+
+
 ==> b148 <==
 # state 1
 @yydgoto=(
index b9110ae4882aa308d35c575d72efa11d99f027d1..95e866ec7736827c61ebe2aea9a98ad5427a04cb 100644 (file)
@@ -31286,12 +31286,24 @@ sub set_vertical_tightness_flags {
             # requested
             my $ovt = $opening_vertical_tightness{$token_end};
 
-            # Turn off the -vt flag if the next line ends in a weld.
-            # This avoids an instability with one-line welds (fixes b1183).
-            my $type_end_next = $types_to_go[$iend_next];
-            $ovt = 0
-              if ( $self->[_rK_weld_left_]->{ $K_to_go[$iend_next] }
-                && $is_closing_type{$type_end_next} );
+            # if we are in -lp and the next line ends in a weld..
+            if (   $rOpts_line_up_parentheses
+                && $self->[_rK_weld_left_]->{ $K_to_go[$iend_next] } )
+            {
+                my $type_end_next = $types_to_go[$iend_next];
+
+                # Turn off -vt if the next line ends in a closing token. This
+                # avoids an instability with one-line welds (b1183).
+                if ( $is_closing_type{$type_end_next} ) {
+                    $ovt = 0;
+                }
+
+                # Turn off -vt if the next line ends in an opening token. This
+                # avoids an instability (b1460).
+                elsif ( $is_opening_type{$type_end_next} ) {
+                    $ovt = 0;
+                }
+            }
 
             # The flag '_rbreak_container_' avoids conflict of -bom and -pt=1
             # or -pt=2; fixes b1270. See similar patch above for $cvt.