From: Steve Hancock Date: Thu, 6 Jun 2024 14:18:11 +0000 (-0700) Subject: fix b1475 X-Git-Tag: 20240511.04~14 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=71770637fff39cb6028e3e9f6028013de2d1a2d4;p=perltidy.git fix b1475 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 27c455ce..59db65ca 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -12149,6 +12149,23 @@ my @global_ops = ( --extended-continuation-indentation --brace-tightness=2 +==> b1475.in <== +run_sub ( + ->$blah{ say "ok 5" ; } ) ; + +run_sub ( ->$blah{ say "ok 5" ; } +) ; + + +==> b1475.par <== +--maximum-line-length=36 +--extended-continuation-indentation +--paren-vertical-tightness=2 +--extended-line-up-parentheses +--space-function-paren +--space-terminal-semicolon +--break-at-old-method-breakpoints + ==> b148.in <== # state 1 @yydgoto=( diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index f761d75a..63e0b9fc 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -8243,6 +8243,14 @@ my @global_ops = ( iparse( {Maxiter => 200, Eps => 1e-4,}, ifhref($opt) ) }; +==> b1475 <== +run_sub ( + ->$blah{ say "ok 5" ; } ) ; + +run_sub ( + ->$blah{ say "ok 5" ; } ) ; + + ==> b148 <== # state 1 @yydgoto=( diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 31ee35ba..db5d7259 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -15650,6 +15650,12 @@ sub keep_old_line_breaks { # leading '->' use a value of 2 which causes a soft # break rather than a hard break if ( $type eq '->' ) { + + # ignore -bom after an opening token ( a syntax error, b1475 ) + my $Kp = $self->K_previous_nonblank($Kfirst); + next if ( !defined($Kp) ); + next if ( $is_opening_type{ $rLL->[$Kp]->[_TYPE_] } ); + $rbreak_before_Kfirst->{$Kfirst} = 2; }