From: Steve Hancock Date: Sun, 29 Sep 2024 22:35:43 +0000 (-0700) Subject: fix c314, c400 X-Git-Tag: 20240903.04~9 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b216e45caa45071d67d35cac5b4db537cb9e7b6e;p=perltidy.git fix c314, c400 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index b5150314..ab362386 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -18882,3 +18882,31 @@ my ( $v1, $v2, $v3, $v4 ); --keyword-group-blanks-after=2 --keyword-group-blanks-before=0 --keyword-group-blanks-size='1.8' + +==> c314.in <== + my $map = + { + dtend => + { # 4.8.2.2 + }, + } ; + +==> c314.par <== +--noadd-whitespace +--indent-columns=0 +--line-up-parentheses +--maximum-line-length=39 +--continuation-indentation=4 + +==> c400.in <== +Readonly::Array my @PATTERNS => ( # requires this side comment + ['A-Z','a-z','0-9','_'] => ['\\w', '\\W'], + ['A-Z','a-z'] => ['[[:alpha:]]','[[:^alpha:]]'], +); + +==> c400.par <== +--indent-columns=0 +--continuation-indentation=3 +--extended-line-up-parentheses +--maximum-line-length=12 +--variable-maximum-line-length diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index e305c91d..5f1d02b7 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -11729,3 +11729,32 @@ my $Quux = bless \$v4, 'Quux'; my $v1; my ( $v1, $v2, $v3, $v4 ); + +==> c314 <== +my $map ={ +dtend => + { # 4.8.2.2 + }, +} ; + +==> c400 <== +Readonly::Array + my @PATTERNS + => ( # requires this side comment +[ + 'A-Z', + 'a-z', + '0-9', + '_' +] => [ + '\\w', + '\\W' +], +[ + 'A-Z', + 'a-z' +] => [ +'[[:alpha:]]', +'[[:^alpha:]]' +], + ); diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 7a06a0f1..dc5bfedb 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -34232,9 +34232,19 @@ EOM # comment we don't know what the space to the actual # next code token will be. We will allow a space for # sub correct_lp to move it in if necessary. - if ( $type eq '#' + # NOTE for c314, c400: this fix is not really necessary, + # and it caused a DEVEL_MODE fault when -i=0. + # It could be completely removed, but this would change + # existing formatting in a few cases. So for now, the fix + # is to only skip this if -i=0. + if ( + $type eq '#' && $max_index_to_go > 0 - && $align_seqno ) + && $align_seqno + + # fix for c314, c400 (see above note) + && $rOpts_indent_columns > 0 + ) { $available_spaces += 1; }