From: Steve Hancock Date: Fri, 12 Nov 2021 00:20:06 +0000 (-0800) Subject: fix b1243, welding under stress X-Git-Tag: 20211029.01~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ccba6999334d24802804489cf1189d2e8193b364;p=perltidy.git fix b1243, welding under stress --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 4822b548..0f4373d4 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8059,6 +8059,44 @@ is( --square-bracket-tightness=0 --weld-nested-containers +==> b1243.in <== +# S1 +use + ExtUtils::MakeMaker; +WriteMakefile( + NAME => +"PDL::Opt::Simplex", + PM => { + map { + ( $_ => +'$(INST_LIBDIR)/' + . $_ ) + } <*.pm> + } +); + +# S2 +use + ExtUtils::MakeMaker; +WriteMakefile( + NAME => +"PDL::Opt::Simplex", + PM => + { map { ( + $_ => +'$(INST_LIBDIR)/' + . $_ ) } + <*.pm> } +); + +==> b1243.par <== +--continuation-indentation=1 +--indent-columns=1 +--line-up-parentheses +--maximum-line-length=11 +--variable-maximum-line-length +--weld-nested-containers + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index e36f1c28..ae64136f 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -8426,17 +8426,9 @@ sub weld_nested_containers { # little space* within a welded container to avoid instability. Note # that after each weld the level values are reduced, so long multiple # welds can still be made. This rule will seldom be a limiting factor - # in actual working code. Fixes b1206. - - # *the current rule is that we require a space of 'ci' + 'i' + 8, - # where 'ci' is the value of n in -ci=n and 'i' is the value in -i=n. + # in actual working code. Fixes b1206, b1243. my $inner_level = $inner_opening->[_LEVEL_]; - my $max_len = $maximum_text_length_at_level[ $inner_level + 1 ]; - my $excess_inside_space = - $max_len - - $rOpts_continuation_indentation - - $rOpts_indent_columns - 8; - if ( $excess_inside_space <= 0 ) { next } + if ( $inner_level > $stress_level + 2 ) { next } # Set flag saying if this pair starts a new weld my $starting_new_weld = !( @welds && $outer_seqno == $welds[-1]->[0] );