From: Steve Hancock Date: Mon, 26 Jun 2023 18:41:42 +0000 (-0700) Subject: fix b1456 X-Git-Tag: 20230309.04~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a2ac214814ab5119e07ff567efcaf406f583ba74;p=perltidy.git fix b1456 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 74c8fea3..9e4b98c6 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -11590,6 +11590,41 @@ if ($BOLD_MATH) { --space-function-paren --want-trailing-commas='b' +==> b1456.in <== + $resources->{$group_id} = + { + id => $group_id, ident => $group_ident, + firstname => $user->{firstname}, + lastname => $user->{lastname}, + email => $user->{email}, + timezone_id => $user->{timezone_id}, + name => $user->{firstname} . + " " . + $user->{lastname}, selected => '0' + }; + + $resources->{$group_id} = + { + id => $group_id, ident => $group_ident, + firstname => $user->{firstname}, + lastname => $user->{lastname}, + email => $user->{email}, + timezone_id => $user->{timezone_id}, + name => $user->{firstname} . + " " . $user->{lastname}, selected => '0', + }; + +==> b1456.par <== +--add-trailing-commas +--break-after-all-operators +--break-at-old-comma-breakpoints +--delete-trailing-commas +--indent-columns=5 +--keep-old-breakpoints-after='Z <<>> += : b = -- ] //= {' +--maximum-line-length=71 +--short-concatenation-item-length=1 +--want-trailing-commas='h' + ==> b146.in <== # State 1 diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index 231e3859..68fb8f17 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -7846,6 +7846,29 @@ if ($BOLD_MATH) { ) } +==> b1456 <== + $resources->{$group_id} = + { + id => $group_id, ident => $group_ident, + firstname => $user->{firstname}, + lastname => $user->{lastname}, + email => $user->{email}, + timezone_id => $user->{timezone_id}, + name => $user->{firstname} . + " " . $user->{lastname}, selected => '0', + }; + + $resources->{$group_id} = + { + id => $group_id, ident => $group_ident, + firstname => $user->{firstname}, + lastname => $user->{lastname}, + email => $user->{email}, + timezone_id => $user->{timezone_id}, + name => $user->{firstname} . + " " . $user->{lastname}, selected => '0', + }; + ==> b146 <== # State 1 @@ -7979,8 +8002,7 @@ Readonly::Array =>( q{$'},q{$$}, q{$#},q{$:}, - ) - ;## no critic ( RequireInterpolationOfMetachars, ProhibitQuotedWordLists ) + );## no critic ( RequireInterpolationOfMetachars, ProhibitQuotedWordLists ) # State 2 Readonly::Array @@ -7988,8 +8010,7 @@ Readonly::Array =>( q{$'},q{$$}, q{$#},q{$:}, - ) - ;## no critic ( RequireInterpolationOfMetachars, ProhibitQuotedWordLists ) + );## no critic ( RequireInterpolationOfMetachars, ProhibitQuotedWordLists ) ==> b183 <== diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 330cde9c..e8185647 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -9918,6 +9918,27 @@ sub match_trailing_comma_rule { { $match = 1; } + + # Patch for instability issue b1456: -boc can trick this test; so + # skip it when deleting commas to avoid possible instability + # with option 'h' in combination with -atc -dtc -boc; + elsif ( + $trailing_comma_style eq 'h' + + # this is a deletion (due to -dtc) + && !$if_add + + # -atc is also set + && $rOpts_add_trailing_commas + + # -boc is set and active + && $rOpts_break_at_old_comma_breakpoints + && !$rOpts_ignore_old_breakpoints + ) + { + # ignore this test + } + else { return; }