From: Steve Hancock Date: Sat, 20 Feb 2021 14:51:05 +0000 (-0800) Subject: Add rule to avoid conflict between -wn and -bom X-Git-Tag: 20210402~39 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5f984f9a5897717f2118cebe170cf10b1a118c11;p=perltidy.git Add rule to avoid conflict between -wn and -bom --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 066e87a7..18a568e2 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -1058,7 +1058,6 @@ sub check_options { $rOpts->{'continuation-indentation'} = $rOpts->{'indent-columns'}; } - if ( $rOpts->{'line-up-parentheses'} ) { if ( $rOpts->{'indent-only'} @@ -6778,6 +6777,9 @@ sub weld_nested_containers { # Return unless there are nested pairs to weld return unless defined($rnested_pairs) && @{$rnested_pairs}; + my $rOpts_break_at_old_method_breakpoints = + $rOpts->{'break-at-old-method-breakpoints'}; + # This array will hold the sequence numbers of the tokens to be welded. my @welds; @@ -7068,6 +7070,25 @@ sub weld_nested_containers { } } + # DO-NOT-WELD RULE 7: Do not weld if this conflicts with -bom + # (case b973) + if ( !$do_not_weld + && $rOpts_break_at_old_method_breakpoints + && $iline_io > $iline_oo ) + { + + foreach my $iline ( $iline_oo + 1 .. $iline_io ) { + my $rK_range = $rlines->[$iline]->{_rK_range}; + next unless defined($rK_range); + my ( $Kfirst, $Klast ) = @{$rK_range}; + next unless defined($Kfirst); + if ( $rLL->[$Kfirst]->[_TYPE_] eq '->' ) { + $do_not_weld = 1; + last; + } + } + } + if ($do_not_weld) { # After neglecting a pair, we start measuring from start of point io diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index bc611439..eaf81324 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,16 @@ =over 4 +=item B + +Testing with ramdom input parameters produced states which were oscillating +because of a conflict between the -wn and -bom parameters. The problem +was resolved by giving the -bom parameter priority over -wn. + +These cases are fixed with this update: b966 b973 + +20 Feb 2021. + =item B Testing with random input parameters produced a number of oscillating states @@ -13,7 +23,7 @@ because a value of -ci greater than -i would not normally be used in practice. These cases are fixed with this update: b707 b770 b912 b920 b930 b933 b939 b940 b941 b942 b978 b974 b979 b980 b981 -20 Feb 2021. +20 Feb 2021, c16c5ee. =item B @@ -23,7 +33,7 @@ This was fixed by adding a small tolerance to line length tests. This fixes cases b654 b655 b943 b944 b967 b968 b969 b970. -19 Feb 2021. +19 Feb 2021, 0baafc8. =item B