]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix conflict of -bom and -scp parameters
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 22 Jul 2021 02:54:55 +0000 (19:54 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 22 Jul 2021 02:54:55 +0000 (19:54 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index a731b1715cbe3d7af8e6b3ec90168efd3305a0cc..f8a4a54e8952d6ad6db9e8c3be3523998536d763 100644 (file)
@@ -6667,6 +6667,30 @@ my $plugin = Koha::FrameworkPlugin->new( {
 --maximum-line-length=55
 --weld-nested-containers
 
+==> b1179.in <==
+# -bom and -scp were interfering
+# S1
+        $resource = {
+                id => $package->new_from_mana(
+                        $result->{data}
+                )->id
+        };
+
+# S2
+        $resource = { id => $package->new_from_mana(
+                        $result->{data} )->id };
+
+# Stable
+        $resource = { id => $package->new_from_mana(
+                        $result->{data}
+        )->id };
+
+==> b1179.par <==
+--break-at-old-method-breakpoints
+--indent-columns=8
+--maximum-line-length=60
+--stack-closing-paren
+
 ==> b120.in <==
 # Same as bug96
 # State 1
index f648a53e0be109a4b6ddcd3f6c08911b8cf69654..1baf45ed7fe792c0d12c232b7e7727e99408d77e 100644 (file)
@@ -21768,6 +21768,8 @@ sub set_vertical_tightness_flags {
     # See case b499 for an example.
     return $rvertical_tightness_flags if ($rOpts_freeze_whitespace);
 
+    my $rwant_container_open = $self->[_rwant_container_open_];
+
     # Uses these parameters:
     #   $rOpts_block_brace_tightness
     #   $rOpts_block_brace_vertical_tightness
@@ -21967,9 +21969,12 @@ sub set_vertical_tightness_flags {
         if (   $is_closing_token{$token_end}
             && $is_closing_token{$token_beg_next} )
         {
+
+            # avoid instability of combo -bom and -sct; b1179
+            my $seq_next = $type_sequence_to_go[$ibeg_next];
             $stackable = $stack_closing_token{$token_beg_next}
-              unless ( $block_type_to_go[$ibeg_next] )
-              ;    # shouldn't happen; just checking
+              unless ( $block_type_to_go[$ibeg_next]
+                || $seq_next && $rwant_container_open->{$seq_next} );
         }
         elsif ($is_opening_token{$token_end}
             && $is_opening_token{$token_beg_next} )
index a424560408d7498a4f0bed2888813643d6e481fd..dee3c30c3a936e56b8a1165f7349539ba61ebe0f 100644 (file)
@@ -2,6 +2,37 @@
 
 =over 4
 
+=item B<Fix conflict of -bom and -scp parameters>
+
+Automated testing with random parameters produced a case of instability caused
+by a conflict of parameters -bom and -scp. In the following script the -bom
+command says to keep the tokens ')->' on a new line, whereas the -scp command
+says to stack the closing paren on the previous line.
+
+        $resource = {
+                id => $package->new_from_mana(
+                        $result->{data}
+                )->id
+        };
+
+The parameters are:
+
+    --break-at-old-method-breakpoints
+    --indent-columns=8
+    --maximum-line-length=60
+    --stack-closing-paren
+
+This caused an instability which was fixed by giving priority to the -bom flag.
+The stable state is then
+
+        $resource = { id => $package->new_from_mana(
+                        $result->{data}
+        )->id };
+
+This fixes case b1179.
+
+21 Jul 2021.
+
 =item B<Fix problems with -kgb in complex structures>
 
 This update fixes two problems involving the -kgb option.
@@ -68,7 +99,7 @@ to go after the closing brace but a line count was off. This has been fixed:
 
 This fixes issue c048.
 
-19 Jul 2021.
+19 Jul 2021, 071a3f6.
 
 =item B<Fix to keep from losing blank lines after a code-skipping section>