]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1310
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 17 Jan 2022 02:11:02 +0000 (18:11 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 17 Jan 2022 02:11:02 +0000 (18:11 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 26f2c9c12e19189a1302da37f6b9b0f8f3371b89..ccd676fedad63a3e5c31c900d03a791bf71e0a44 100644 (file)
@@ -9241,6 +9241,38 @@ else
 --maximum-line-length=46
 --weld-nested-containers
 
+==> b1310.in <==
+isnt(
+      exception {
+          $meta =
+            Moose::Meta::Class->create_anon_class(
+                       superclasses => ['t::bugs::Bar',], # any old class will work
+                       roles        => ['Role::BreakOnLoad',], )
+      },
+      undef,
+      'Class dies when attempting composition'
+);
+
+isnt(
+      exception {
+          $meta =
+            Moose::Meta::Class->create_anon_class(
+                                               superclasses => ['t::bugs::Bar',]
+                                               ,    # any old class will work
+                                               roles => ['Role::BreakOnLoad',],
+            )
+      },
+      undef,
+      'Class dies when attempting composition'
+);
+
+
+==> b1310.par <==
+--extended-line-up-parentheses
+--maximum-line-length=71
+--square-bracket-tightness=2
+--variable-maximum-line-length
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index 7716021e562d580d2b0a2d9f615e839c02a97e18..19392a311c5bca48c1de7b9666fae2717ec38169 100644 (file)
@@ -1509,6 +1509,20 @@ EOM
         }
     }
 
+    #-------------------------------------------------------------------
+    # The combination -xlp and -vmll can be unstable unless -iscl is set
+    #-------------------------------------------------------------------
+    # This is a temporary fix for issue b1302.  See also b1306, b1310.
+    # FIXME: look for a better fix.
+    if (   $rOpts->{'variable-maximum-line-length'}
+        && $rOpts->{'extended-line-up-parentheses'}
+        && !$rOpts->{'ignore-side-comment-lengths'} )
+    {
+        $rOpts->{'ignore-side-comment-lengths'} = 1;
+
+        # we could write a warning here
+    }
+
     #-----------------------------------------------------------
     # The combination -lp -vmll can be unstable if -ci<2 (b1267)
     #-----------------------------------------------------------
@@ -10719,15 +10733,8 @@ sub collapsed_lengths {
             {
                 my $Kend = $K_terminal;
 
-                # 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 )
+                if ( $has_comment
+                    && !$rOpts_ignore_side_comment_lengths )
                 {
                     $Kend = $K_last;
                 }