From: Steve Hancock Date: Thu, 21 Sep 2023 15:07:38 +0000 (-0700) Subject: fix case b1460 X-Git-Tag: 20230912.02~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a74b3517e418ae2b6334c891d143282d933de4be;p=perltidy.git fix case b1460 --- diff --git a/dev-bin/perltidy_random_setup.pl b/dev-bin/perltidy_random_setup.pl index aa44a5b3..92443d64 100755 --- a/dev-bin/perltidy_random_setup.pl +++ b/dev-bin/perltidy_random_setup.pl @@ -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); diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 18e6388a..a041480a 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -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=( diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index 5a8ec0e0..615c743f 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -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=( diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index b9110ae4..95e866ec 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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.