From: Steve Hancock <perltidy@users.sourceforge.net> Date: Fri, 26 Feb 2021 15:57:00 +0000 (-0800) Subject: Update rule for spacing paren after constant function X-Git-Tag: 20210402~34 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=12bfdfe0eee8171a34b408d7a809c9d9afaaa876;p=perltidy.git Update rule for spacing paren after constant function --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 1b179eb6..1c10b85a 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -2156,7 +2156,8 @@ sub set_whitespace_flags { # 'w' and 'i' checks for something like: # myfun( &myfun( ->myfun( # ----------------------------------------------------- - elsif (( $last_type =~ /^[wUG]$/ ) + # Patch: added 'C' to prevent blinker, case b934, i.e. 'pi()' + elsif (( $last_type =~ /^[wCUG]$/ ) || ( $last_type =~ /^[wi]$/ && $last_token =~ /^(\&|->)/ ) ) { $ws = WS_NO unless ($rOpts_space_function_paren); diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 4e3ab857..9a9f2570 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,31 @@ =over 4 +=item B<Update rule for spacing paren after constant function> + +Random testing produced an unstable state for the following snippet (case b934) + + sub pi(); + if ( + $t > + pi( ) + ) + +when run with these parameters: + + --continuation-indentation=6 + --maximum-line-length=17 + --paren-vertical-tightness-closing=2 + +The formatting was stable without the first line, which declares 'pi' to be +a constant sub. The problem was fixed by updating a regex to treat the spacing +of a paren following a sub the same for the two token types, 'U' or 'C' +(constant function). + +This fixes case b934. + +26 Feb 2021. + =item B<Improve line length test for the -vtc=2 option> This is a small change to the update of 13 Feb 2021, f79a4f1. Random testing