From 1a1f8b498a39e76303bd052ceb0b5b87bef30ca6 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 12 Jul 2024 16:09:11 -0700 Subject: [PATCH] fix some minor -wmr issues --- lib/Perl/Tidy/Formatter.pm | 35 ++++++++++++++++++++++++++++++--- local-docs/Release-Checklist.md | 1 + 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 3bb4d9ce..e3bed0b1 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -13916,9 +13916,30 @@ sub count_list_elements { next; } - # enter a list slice, such as '(caller)[1,2]' my $Kc = $self->[_K_closing_container_]->{$seqno}; if ( !$Kc ) { $backup_on_last->(); last } + + # Enter nested parens with inner list + # ( ( $v1, $v2) ) + # | | | | + # $KK $Kn $Kc_p $Kc + if ( $self->[_rhas_list_]->{$seqno} ) { + my $Kc_p = $self->K_previous_code($Kc); + if ( $Kc_p && $rLL->[$Kc_p]->[_TOKEN_] eq ')' ) { + my $seqno_c_p = + $rLL->[$Kc_p]->[_TYPE_SEQUENCE_]; + if ( $seqno_c_p && $seqno_c_p == $seqno + 1 ) { + my $Kn = $self->K_next_code($KK); + if ( $Kn && $rLL->[$Kn]->[_TOKEN_] eq '(' ) + { + push @seqno_stack, $seqno; + next; + } + } + } + } + + # enter a list slice, such as '(caller)[1,2]' my $Kn = $self->K_next_code($Kc); if ( $Kn && $rLL->[$Kn]->[_TOKEN_] eq '[' ) { my $seqno_next = $rLL->[$Kn]->[_TYPE_SEQUENCE_]; @@ -13973,6 +13994,9 @@ sub count_list_elements { # ',(' $ok ||= $type_last eq ','; + # '((' + $ok ||= $token_last eq '('; + # 'wantarray ? (' $ok ||= $KK_last_last_nb @@ -15026,8 +15050,13 @@ sub count_return_values_wanted { my $token_c = $rLL->[$K_c]->[_TOKEN_]; if ( $token_c ne ')' ) { - # handle @array = f(x) or $scalar=f(x) - if ( $type_c eq 'i' ) { + # Handle @array = f(x) or $scalar=f(x) + # NOTE: This is deactivated because we only want to do checks + # at something like ') ='. Otherwise we risk producing false + # warnings. It could be reactivated in the future to produce + # information, but it would need to update some new variable + # other than {return_count_wanted}. + if ( 0 && $type_c eq 'i' ) { my $sigil = substr( $token_c, 0, 1 ); if ( $sigil eq '$' ) { $item->{return_count_wanted} = 1; diff --git a/local-docs/Release-Checklist.md b/local-docs/Release-Checklist.md index 6630002f..c0752a92 100644 --- a/local-docs/Release-Checklist.md +++ b/local-docs/Release-Checklist.md @@ -23,6 +23,7 @@ - compare run time with previous version - review tickets at sourceforge (hardly used now, but possible) - review/update the CHANGES.md file +- Check/update copyright date: perltidy and Tidy.pm (2 places) - be sure RPerl still works: - build and install the latest Perl::Tidy on development machine - install the latest RPerl [currently RPerl-7.000000] -- 2.39.5