]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1302, b1306: rare instability with combo -vmll -xlp -!iscl
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 10 Jan 2022 15:10:30 +0000 (07:10 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 10 Jan 2022 15:10:30 +0000 (07:10 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index ed29a88d30879906176f27f3a015ad8f81baa8a4..c0af63ef563bbcc5667a044a440016151fc28e67 100644 (file)
@@ -9072,6 +9072,27 @@ subtest '->save' => sub {
 --space-function-paren
 --vertical-tightness=1
 
+==> b1302.in <==
+use vars (
+   q!$Start_Dir!
+   , # The top directory find was called with
+   q!%Future!
+   ,    # topdirs find will handle later
+);
+
+use vars (
+ q!$Start_Dir!
+ ,   # The top directory find was called with
+ q!%Future!, # topdirs find will handle later
+);
+
+==> b1302.par <==
+--extended-line-up-parentheses
+--indent-columns=3
+--maximum-line-length=42
+--paren-tightness=2
+--variable-maximum-line-length
+
 ==> b1303.in <==
 if (
     (
@@ -9143,6 +9164,31 @@ my %Map =(
 --indent-columns=2
 --maximum-line-length=53
 
+==> b1306.in <==
+$oreo =
+  cookie(
+        -NAME    => 'filling',
+        -VALUE   => "vanilla crème",
+        -EXPIRES => '+3M'
+        ,   # M for month, m for minute
+        -DOMAIN => '.perl.com'
+  );
+
+$oreo = cookie(
+    -NAME    => 'filling',
+    -VALUE   => "vanilla crème",
+    -EXPIRES => '+3M'
+    ,    # M for month, m for minute
+    -DOMAIN => '.perl.com'
+);
+
+
+==> b1306.par <==
+--extended-continuation-indentation
+--extended-line-up-parentheses
+--maximum-line-length=35
+--variable-maximum-line-length
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
index 0008c0f2767415847c607653c5329c51a3f25dea..e93362cb12a254d21465b943a32f5f4be431ed9f 100644 (file)
@@ -10664,11 +10664,22 @@ sub collapsed_lengths {
               )
             {
                 my $Kend = $K_terminal;
-                if ( $has_comment && !$rOpts_ignore_side_comment_lengths ) {
+
+                # Ignore comment length if -vmll. Some rare instabilities have
+                # been found involving side comments and -vmll. So side comment
+                # lengths are ignored in this loop if -vmll is set for now.
+                # (They are still checked elsewhere). This could cause
+                # occasional excess line lengths, but -vmll use is rare and
+                # that is preferable to instability.  Fixes b1302 and b1306.
+                if (   $has_comment
+                    && !$rOpts_ignore_side_comment_lengths
+                    && !$rOpts_variable_maximum_line_length )
+                {
                     $Kend = $K_last;
                 }
                 $len = $rLL->[$Kend]->[_CUMULATIVE_LENGTH_] -
                   $rLL->[ $K_first - 1 ]->[_CUMULATIVE_LENGTH_];
+
                 if ( $len > $max_prong_len ) { $max_prong_len = $len }
 
                 # TODO: if there are no sequence items in the line we could