]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1211, rare formatting instability
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 8 Oct 2021 22:16:08 +0000 (15:16 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 8 Oct 2021 22:16:08 +0000 (15:16 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm
local-docs/Release-Checklist.md

index 8722f6df15c620b0408b67009bc1d63b2c7b8b42..cebf06fc196a63bbafa9d8c7c84b2536ff5394a4 100644 (file)
@@ -7456,6 +7456,33 @@ $bc[
 --maximum-line-length=34
 --variable-maximum-line-length
 
+==> b1211.in <==
+# S1
+ my$d=
+   \substr(
+           (state$tb=
+            $thunderbirds[$x]),
+           $x,1
+   );
+
+# S2
+ my$d=
+   \substr(
+           (
+            state$tb=$thunderbirds[
+              $x]
+           ),
+           $x,1
+   );
+
+
+==> b1211.par <==
+--noadd-whitespace
+--ignore-old-breakpoints
+--indent-columns=1
+--line-up-parentheses
+--maximum-line-length=37
+
 ==> b1212.in <==
 # S1
   my $line_count
index a9694952583b3c4b0aaba2e6fde60453becb1d33..4eeca31465f08ddc7a5efbdadb5d0389f43f0460 100644 (file)
@@ -17910,7 +17910,8 @@ BEGIN {
     my @q = qw(k w i Z ->);
     @is_kwiZ{@q} = (1) x scalar(@q);
 
-    @q = qw<( [ { L R } ] ) b>;
+    # added = for b1211
+    @q = qw<( [ { L R } ] ) = b>;
     push @q, ',';
     @is_key_type{@q} = (1) x scalar(@q);
 }
@@ -17959,7 +17960,12 @@ sub find_token_starting_list {
         # previous loop: for ( my $j = $im1 ; $j >= 0 ; $j-- ) {
         for ( my $j = $iprev_nb ; $j >= 0 ; $j-- ) {
             ##last if ( $types_to_go[$j] =~ /^[\(\[\{L\}\]\)Rb,]$/ );
-            last if ( $is_key_type{ $types_to_go[$j] } );
+            if ( $is_key_type{ $types_to_go[$j] } ) {
+
+                # fix for b1211
+                if ( $types_to_go[$j] eq '=' ) { $i_opening_minus = $j }
+                last;
+            }
             $i_opening_minus = $j;
         }
         if ( $types_to_go[$i_opening_minus] eq 'b' ) { $i_opening_minus++ }
@@ -19403,15 +19409,12 @@ sub get_available_spaces_to_go {
                             if (   $gnu_sequence_number != $seqno
                                 || $i > $max_gnu_item_index )
                             {
+                                # non-fatal, keep going except in DEVEL_MODE
                                 if (DEVEL_MODE) {
                                     Fault(<<EOM);
 Program bug with -lp.  seqno=$seqno should be $gnu_sequence_number and i=$i should be less than max=$max_gnu_item_index
 EOM
                                 }
-                                warning(
-"Program bug with -lp.  seqno=$seqno should be $gnu_sequence_number and i=$i should be less than max=$max_gnu_item_index\n"
-                                );
-                                report_definite_bug();
                             }
                             else {
                                 if ( $arrow_count == 0 ) {
@@ -19452,16 +19455,13 @@ EOM
                 # only negative levels can get here, and $level was forced
                 # to be positive above.
                 else {
+
+                    # non-fatal, keep going except in DEVEL_MODE
                     if (DEVEL_MODE) {
                         Fault(<<EOM);
 program bug with -lp: stack_error. level=$level; lev=$lev; ci_level=$ci_level; ci_lev=$ci_lev; rerun with -nlp
 EOM
                     }
-
-                    warning(
-"program bug with -lp: stack_error. level=$level; lev=$lev; ci_level=$ci_level; ci_lev=$ci_lev; rerun with -nlp\n"
-                    );
-                    report_definite_bug();
                     last;
                 }
             }
@@ -19761,20 +19761,16 @@ EOM
 
                 # shouldn't happen except for code bug:
                 else {
-                    my $level        = $gnu_item_list[$i_debug]->get_level();
-                    my $ci_level     = $gnu_item_list[$i_debug]->get_ci_level();
-                    my $old_level    = $gnu_item_list[$i]->get_level();
-                    my $old_ci_level = $gnu_item_list[$i]->get_ci_level();
+                    # non-fatal, keep going except in DEVEL_MODE
                     if (DEVEL_MODE) {
+                        my $level    = $gnu_item_list[$i_debug]->get_level();
+                        my $ci_level = $gnu_item_list[$i_debug]->get_ci_level();
+                        my $old_level    = $gnu_item_list[$i]->get_level();
+                        my $old_ci_level = $gnu_item_list[$i]->get_ci_level();
                         Fault(<<EOM);
 program bug with -lp: want to delete $deleted_spaces from item $i, but old=$old_spaces deleted: lev=$level ci=$ci_level  deleted: level=$old_level ci=$ci_level
 EOM
                     }
-
-                    warning(
-"program bug with -lp: want to delete $deleted_spaces from item $i, but old=$old_spaces deleted: lev=$level ci=$ci_level  deleted: level=$old_level ci=$ci_level\n"
-                    );
-                    report_definite_bug();
                 }
             }
             $gnu_position_predictor -= $deleted_spaces;
index c13eb6563cbaefc70a51e2f761613cff903c294a..684ae4b7493d39a89b4c06e328a8404008160f2f 100644 (file)
@@ -3,13 +3,12 @@
 - review tickets at [rt.cpan.org](https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy) 
 - review the issues at [github](https://github.com/perltidy/perltidy/issues/)
 - compare formatting with the new version with previous version on all files in test area
-- run a blinker test (activate option -I and look for 'Blinker' in DIAGNOSTICS)
-- run a timing test: compare run time with previous version
 - profile with Devel::NYTProf with different parameters and compare with previous version: For example
   perl -d:NYTProf perltidy.pl -pbp -nst -nse -wn -xci perltidy.pl
   nytprofhtml --open
-- run random testing on final version for a significant time before releasing (several days)
-- rerun all resolved blinker test cases to verify that all still run correctly
+- compare run time with previous version
+- release candidate should show no irregularities in at least 24 cpu hours of random testing
+- run 'devbin/run__convergence_tests.pl' to insure convergence
 - run 'author tests' on a much larger body of code than is covered by the .t
   files.
     - compare results of the current version with previous version