]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1243, welding under stress
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 12 Nov 2021 00:20:06 +0000 (16:20 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 12 Nov 2021 00:20:06 +0000 (16:20 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 4822b54858184adb071ee834f6a33058fdec4e54..0f4373d4aa34f2d61834e9ab4b5f5825808a53f7 100644 (file)
@@ -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" ) )
index e36f1c288430d64479b8c64983730750b63b0b81..ae64136f7660628a419b3271acd4751ced6bfaa0 100644 (file)
@@ -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] );