]> git.donarmstrong.com Git - perltidy.git/commitdiff
adjust weld rules to fix issue b1339
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 28 Apr 2022 18:53:54 +0000 (11:53 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 28 Apr 2022 18:53:54 +0000 (11:53 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index fe7aeeec75cc42547fba1b0ac2789b8ef0298de2..1276458ffc333377864e954bc154ce79992b7acb 100644 (file)
@@ -9802,6 +9802,40 @@ params =>
 --space-function-paren
 --weld-nested-containers
 
+==> b1339.in <==
+# S1
+   $LANGUAGE{'groff'}={
+                       'filename'=>'\\.groff$',
+                       'regex'=>'',
+                       'patterns'=>[
+                                    {
+                                     'name'=>'comment',
+                                     'regex'=>'\\\\".*?$',
+                                     'style'=>'comment',
+                                     'childregex'=>[]
+                                    }
+                       ]
+   };
+
+# S2
+   $LANGUAGE{'groff'}={
+        'filename'=>'\\.groff$',
+        'regex'=>'',
+        'patterns'=>[{'name'=>'comment','regex'=>'\\\\".*?$','style'=>'comment','childregex'=>[]}]
+   };
+
+==> b1339.par <==
+--noadd-whitespace
+--brace-vertical-tightness-closing=1
+--comma-arrow-breakpoints=0
+--continuation-indentation=8
+--extended-line-up-parentheses
+--ignore-old-breakpoints
+--indent-columns=3
+--maximum-line-length=98
+--square-bracket-vertical-tightness=2
+--weld-nested-containers
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index 534304d2cb98c9e975a38dc6f39187e947ba1bf6..ed5321e1afab52db6536adffb648ab7967325206 100644 (file)
@@ -8744,9 +8744,11 @@ sub weld_nested_containers {
     # Setup hash needed for RULE 2B involving -lp -wn -vt=2
     # Note: this could be changed in the future to include -vt=1 and -vt=2
     # but for now only -vt=2 has caused instabilities with -wn.
+    # Note: used all keys for b1338, but switched to just '(' to fix b1339.
     my %no_weld_to_one_line_container;
     if ($rOpts_line_up_parentheses) {
-        foreach ( keys %opening_vertical_tightness ) {
+        ##foreach ( keys %opening_vertical_tightness ) {
+        foreach ( '(' ) {
             if ( $opening_vertical_tightness{$_} == 2 ) {
                 $no_weld_to_one_line_container{$_} = 1;
             }
@@ -9153,8 +9155,8 @@ EOM
         }
 
         # DO-NOT-WELD RULE 2B: Turn off welding to a *one-line container for* an
-        # opening token which uses both -lp indentation and -vt=2.  See issue
-        # b1338. Also see related issue b1183 involving welds and -vt>0.
+        # opening token which uses both -lp indentation and -vt=2.  See issues
+        # b1338, b1339. Also see related issue b1183 involving welds and -vt>0.
         if (  !$do_not_weld_rule
             && %no_weld_to_one_line_container
             && $iline_io == $iline_ic