]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix -asbl -wn instability, issues b1268, b1269, b1277, b1278
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 3 Jan 2022 23:36:21 +0000 (15:36 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 3 Jan 2022 23:36:21 +0000 (15:36 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 36816d8bd473e2ef27d20bb64ae29468fdb0420a..0c86385a2338047cae15adad536b2e3e032fa14d 100644 (file)
@@ -8471,6 +8471,50 @@ function(
 --maximum-line-length=30
 --variable-maximum-line-length
 
+==> b1268.in <==
+$|||=sub
+{   ($_[$[<$]],$_[$[])
+};
+
+$|||=sub
+{($_[$[<$]],$_[$[])};
+
+==> b1268.par <==
+--noadd-whitespace
+--block-brace-vertical-tightness=1
+--continuation-indentation=5
+--delete-old-whitespace
+--line-up-parentheses
+--maximum-line-length=26
+--opening-anonymous-sub-brace-on-new-line
+--variable-maximum-line-length
+--weld-nested-containers
+
+==> b1269.in <==
+use overload
+     "=="=>\&_equals,
+     "!="=>
+     sub{not _equals(@_)},
+     q{""}=>
+     sub{($_[0]->{_type})};
+
+use overload
+     "=="=>\&_equals,
+     "!="=>
+     sub{not _equals(@_)},
+     q{""}=>sub
+{($_[0]->{_type})};
+
+
+==> b1269.par <==
+--noadd-whitespace
+--continuation-indentation=5
+--line-up-parentheses
+--maximum-line-length=26
+--opening-anonymous-sub-brace-on-new-line
+--variable-maximum-line-length
+--weld-nested-containers
+
 ==> b1270.in <==
           $this->{SymAutoCor} = (
                     PDL->zeroes(
@@ -8561,6 +8605,54 @@ function(
 --keyword-paren-inner-tightness=2
 --maximum-line-length=56
 
+==> b1277.in <==
+# S1
+          match_on_type @_ => Null => sub { [] },
+                  ArrayRef =>
+                  sub { [ @{ rev ( tail ($_) ) }, head ($_) ] } ;
+
+# S2
+          match_on_type @_ => Null => sub { [] },
+                  ArrayRef =>
+                  sub { [
+                    @{ rev ( tail ($_) ) }, head ($_) ] } ;
+
+# S3
+          match_on_type @_ => Null => sub { [] },
+                  ArrayRef => sub
+          { [ @{ rev ( tail ($_) ) }, head ($_) ] } ;
+
+
+==> b1277.par <==
+--continuation-indentation=8
+--indent-columns=10
+--line-up-parentheses
+--maximum-line-length=64
+--opening-anonymous-sub-brace-on-new-line
+--space-function-paren
+--space-terminal-semicolon
+--weld-nested-containers
+
+==> b1278.in <==
+# S1
+    match_on_type @_  => Null => sub { [] },
+             ArrayRef => sub
+    { [ @{ rev( tail($_) ) }, head($_) ] };
+
+# S2
+    match_on_type @_  => Null => sub { [] },
+             ArrayRef => sub
+    {   [ @{ rev( tail($_) ) }, head($_) ]
+    };
+
+==> b1278.par <==
+--block-brace-vertical-tightness=2
+--continuation-indentation=9
+--extended-line-up-parentheses
+--maximum-line-length=52
+--opening-anonymous-sub-brace-on-new-line
+--weld-nested-containers
+
 ==> b1280.in <==
 # S1
     for my $method qw(GetBook Wishlist AddBook RemoveBook
index bd61ae0a39643e526c131beece626529aba64aee..1341dc50ae0ec2478c43fd82d46f6ef27ff416a4 100644 (file)
@@ -8881,10 +8881,13 @@ EOM
         # DO-NOT-WELD RULE 2A:
         # Do not weld an opening asub brace in -lp mode to avoid interfering
         # with one-line block formation.  Fixes b1241.
-        if (  !$do_not_weld_rule
-            && $is_one_line_weld
+        # Removed 1-line test to fix b1268.  See also b1269, b1277, b1278.
+        if (
+            !$do_not_weld_rule
+            ##&& $is_one_line_weld
             && $rOpts_line_up_parentheses
-            && $ris_asub_block->{$outer_seqno} )
+            && $ris_asub_block->{$outer_seqno}
+          )
         {
             $do_not_weld_rule = '2A';
         }
@@ -18531,11 +18534,9 @@ EOM
                 # b1264 to see if this check is still required at all, and
                 # these still require a check, but at higher level beta+3
                 # instead of beta:  b1193 b780
-                if (
-                    $saw_opening_structure
+                if (   $saw_opening_structure
                     && !$lp_object
-                    && $levels_to_go[$i_opening] >= $list_stress_level
-                  )
+                    && $levels_to_go[$i_opening] >= $list_stress_level )
                 {
                     $cab_flag = 2;
 
@@ -19797,12 +19798,13 @@ EOM
             # but turn off word wrap where requested
             if ($rOpts_break_open_paren_list) {
 
-                #  '0' matches no parens
-                #  '1' matches all parens
-                #  otherwise use same values as weld-exclusion-list
+                # This parameter is a one-character flag, as follows:
+                #  '0' matches no parens  -> break open NOT OK -> word wrap OK
+                #  '1' matches all parens -> break open OK -> word wrap NOT OK
+                #  Other values are the same as used by the weld-exclusion-list
                 my $flag = $rOpts_break_open_paren_list;
-                if (   $flag eq '1'
-                    || $flag eq '*' )
+                if (   $flag eq '*'
+                    || $flag eq '1' )
                 {
                     $two_line_word_wrap_ok = 0;
                 }