From d1fbeaba9aa8e8537fa8987ca0ec736fa7b05e52 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sat, 19 Mar 2022 07:56:59 -0700 Subject: [PATCH] fix unusual formatting issue b1319 --- dev-bin/run_convergence_tests.pl.data | 25 +++++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 57ef1797..6dfdeffa 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9433,6 +9433,31 @@ my %config = ( --maximum-line-length=19 --variable-maximum-line-length +==> b1319.in <== +# S1 +my @tests = ( + { + expects => [ + sort qw/ Class::Moose::RoleList1 Class::Moose::RoleList2 / + ], + }, +); + +# S2 +my @tests = ( + { + expects => [ + sort + qw/ Class::Moose::RoleList1 Class::Moose::RoleList2 / + ], + }, +); + +==> b1319.par <== +--continuation-indentation=7 +--extended-line-up-parentheses +--keep-old-breakpoints-after='q' + ==> b1321.in <== my $parser = Pod::Markdown->new( diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index fa436d6d..7c9de631 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -10873,6 +10873,11 @@ sub collapsed_lengths { $level_start_multiline_qw = $rLL->[$K_start_multiline_qw]->[_LEVEL_]; } + else { + + # Fix for b1319, b1320 + goto NOT_MULTILINE_QW; + } } } @@ -10904,6 +10909,8 @@ sub collapsed_lengths { next if ( $K_begin_loop > $K_last ); } + + NOT_MULTILINE_QW: $K_start_multiline_qw = undef; # Find the terminal token, before any side comment -- 2.39.5