fix some minor -wmr issues
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 12 Jul 2024 23:09:11 +0000 (16:09 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 12 Jul 2024 23:09:11 +0000 (16:09 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/Release-Checklist.md

index 3bb4d9ce316641f704316609ac4075eae50e7245..e3bed0b18ab9c1496a29a0e0bf7019fe7bf6ad4d 100644 (file)
@@ -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;
index 6630002f67ebfe17b12489a1ca17b0e832a542c1..c0752a928e7e9e2bfc1f8cfe7b52e78e3beb316e 100644 (file)
@@ -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]