]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1423
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 3 Nov 2022 14:15:23 +0000 (07:15 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 3 Nov 2022 14:15:23 +0000 (07:15 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index ef54fa6a318c2f64c6d1af6559787074c8458c49..3ff688645058a22f7d60e0fb0d0a9a3dc84cbd55 100644 (file)
@@ -10843,6 +10843,36 @@ L2hos
 --paren-vertical-tightness=1
 --weld-nested-containers
 
+==> b1423.in <==
+                if ( L2hos
+                     ->Link( $image2,
+                             $image1,
+                     )
+                  )
+                {
+                    L2hos
+                      ->Unlink($tmp);
+                }
+
+                if (
+                     L2hos
+                     ->Link( $image2,
+                             $image1,
+                     )
+                  )
+                {
+                    L2hos
+                      ->Unlink($tmp);
+                }
+
+
+==> b1423.par <==
+--break-at-old-comma-breakpoints
+--break-at-old-method-breakpoints
+--extended-line-up-parentheses
+--paren-vertical-tightness=1
+--weld-nested-containers
+
 ==> b146.in <==
 # State 1
 
index ffcb8a4ad0923058acc589d72a0ce798282007ef..d32e44f76cb8aaa88204bd8d86642517373c4586 100644 (file)
@@ -9960,6 +9960,26 @@ sub weld_nested_containers {
         my $token_oo = $outer_opening->[_TOKEN_];
         my $token_io = $inner_opening->[_TOKEN_];
 
+        # DO-NOT-WELD RULE 7: Do not weld if this conflicts with -bom
+        # Added for case b973. Moved here from below to fix b1423.
+        if (  !$do_not_weld_rule
+            && $rOpts_break_at_old_method_breakpoints
+            && $iline_io > $iline_oo )
+        {
+
+            foreach my $iline ( $iline_oo + 1 .. $iline_io ) {
+                my $rK_range = $rlines->[$iline]->{_rK_range};
+                next unless defined($rK_range);
+                my ( $Kfirst, $Klast ) = @{$rK_range};
+                next unless defined($Kfirst);
+                if ( $rLL->[$Kfirst]->[_TYPE_] eq '->' ) {
+                    $do_not_weld_rule = 7;
+                    last;
+                }
+            }
+        }
+        next if ($do_not_weld_rule);
+
         # Turn off vertical tightness completely at possible one-line welds.
         # Fixes b1402.  This also fixes issues b1338, b1339, b1340, b1341,
         # b1342, b1343, but both fixes are needed in general for good
@@ -10323,25 +10343,6 @@ EOM
 
         # DO-NOT-WELD RULE 6: This has been merged into RULE 3 above.
 
-        # DO-NOT-WELD RULE 7: Do not weld if this conflicts with -bom
-        # (case b973)
-        if (  !$do_not_weld_rule
-            && $rOpts_break_at_old_method_breakpoints
-            && $iline_io > $iline_oo )
-        {
-
-            foreach my $iline ( $iline_oo + 1 .. $iline_io ) {
-                my $rK_range = $rlines->[$iline]->{_rK_range};
-                next unless defined($rK_range);
-                my ( $Kfirst, $Klast ) = @{$rK_range};
-                next unless defined($Kfirst);
-                if ( $rLL->[$Kfirst]->[_TYPE_] eq '->' ) {
-                    $do_not_weld_rule = 7;
-                    last;
-                }
-            }
-        }
-
         if ($do_not_weld_rule) {
 
             # After neglecting a pair, we start measuring from start of point