From 7243ac21ef7a125a21d662c1a8e20a88dada8e94 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 12 Sep 2023 12:59:38 -0700 Subject: [PATCH] fix for git #124 --- CHANGES.md | 5 ++++ bin/perltidy | 2 +- docs/ChangeLog.html | 6 +++++ docs/Tidy.html | 2 +- docs/perltidy.html | 2 +- lib/Perl/Tidy.pm | 2 +- lib/Perl/Tidy.pod | 2 +- lib/Perl/Tidy/Debugger.pm | 2 +- lib/Perl/Tidy/Diagnostics.pm | 2 +- lib/Perl/Tidy/FileWriter.pm | 2 +- lib/Perl/Tidy/Formatter.pm | 2 +- lib/Perl/Tidy/HtmlWriter.pm | 2 +- lib/Perl/Tidy/IOScalar.pm | 2 +- lib/Perl/Tidy/IOScalarArray.pm | 2 +- lib/Perl/Tidy/IndentationItem.pm | 2 +- lib/Perl/Tidy/Logger.pm | 2 +- lib/Perl/Tidy/Tokenizer.pm | 10 +++++--- lib/Perl/Tidy/VerticalAligner.pm | 2 +- lib/Perl/Tidy/VerticalAligner/Alignment.pm | 2 +- lib/Perl/Tidy/VerticalAligner/Line.pm | 2 +- t/snippets/expect/git124.def | 8 +++++++ t/snippets/git124.in | 8 +++++++ t/snippets/packing_list.txt | 5 ++-- t/snippets28.t | 27 ++++++++++++++++++++++ 24 files changed, 81 insertions(+), 22 deletions(-) create mode 100644 t/snippets/expect/git124.def create mode 100644 t/snippets/git124.in diff --git a/CHANGES.md b/CHANGES.md index f215aba0..9b63831c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # Perltidy Change Log +## 2023 09 12 + + - Fix for git #124: remove a syntax error check which could cause + an incorrect error message when List::Gather::gather was used. + ## 2023 09 09 - Added new parameters -wme, or --warn-missing-else, and -ame, diff --git a/bin/perltidy b/bin/perltidy index 0ba47c79..e1bfac64 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -5878,7 +5878,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20230909 +This man page documents perltidy version 20230912 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 890dde2e..05b1f064 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,5 +1,11 @@

Perltidy Change Log

+

2023 09 12

+ +
- Fix for git #124: remove a syntax error check which could cause
+  an incorrect error message when List::Gather::gather was used.
+
+

2023 09 09

- Added new parameters -wme, or --warn-missing-else, and -ame,
diff --git a/docs/Tidy.html b/docs/Tidy.html
index 08176cfd..4a755b8b 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20230909

+

This man page documents Perl::Tidy version 20230912

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index a8529626..18cc3049 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -4597,7 +4597,7 @@

VERSION

-

This man page documents perltidy version 20230909

+

This man page documents perltidy version 20230912

BUG REPORTS

diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index c059e79d..12b207ea 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -111,7 +111,7 @@ BEGIN { # then the Release version must be bumped, and it is probably past time for # a release anyway. - $VERSION = '20230909'; + $VERSION = '20230912'; } ## end BEGIN sub DESTROY { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index d420dc8c..277a34a4 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -469,7 +469,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t =head1 VERSION -This man page documents Perl::Tidy version 20230909 +This man page documents Perl::Tidy version 20230912 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index ffba2cec..7d0ae443 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230909'; +our $VERSION = '20230912'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index e1dbb90a..2826fd29 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230909'; +our $VERSION = '20230912'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 877ff0c7..44ad10b3 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20230909'; +our $VERSION = '20230912'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index aeb77367..c5cca237 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -53,7 +53,7 @@ use constant SPACE => q{ }; use Carp; use English qw( -no_match_vars ); use List::Util qw( min max first ); # min, max first are in Perl 5.8 -our $VERSION = '20230909'; +our $VERSION = '20230912'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index 4ed4ead8..d1f03873 100644 --- a/lib/Perl/Tidy/HtmlWriter.pm +++ b/lib/Perl/Tidy/HtmlWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::HtmlWriter; use strict; use warnings; -our $VERSION = '20230909'; +our $VERSION = '20230912'; use English qw( -no_match_vars ); use File::Basename; diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index f1d6cc85..386d0d11 100644 --- a/lib/Perl/Tidy/IOScalar.pm +++ b/lib/Perl/Tidy/IOScalar.pm @@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar; use strict; use warnings; use Carp; -our $VERSION = '20230909'; +our $VERSION = '20230912'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index be5531e6..deb54bdc 100644 --- a/lib/Perl/Tidy/IOScalarArray.pm +++ b/lib/Perl/Tidy/IOScalarArray.pm @@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray; use strict; use warnings; use Carp; -our $VERSION = '20230909'; +our $VERSION = '20230912'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index a9a8b86a..83cfb15f 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -8,7 +8,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20230909'; +our $VERSION = '20230912'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 27ad2d72..7daf0819 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20230909'; +our $VERSION = '20230912'; use English qw( -no_match_vars ); use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index f63dc7e7..e5289e28 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -22,7 +22,7 @@ use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230909'; +our $VERSION = '20230912'; use Carp; @@ -3199,8 +3199,12 @@ EOM if ( defined($rvars) ) { my ( $type_lp, $want_brace ) = @{$rvars}; - # Now verify that this is not a trailing form - if ( !$want_brace ) { + # OLD: Now verify that this is not a trailing form + # FIX for git #124: we have to skip this check because + # the 'gather' keyword of List::Gather can operate on + # a full statement, so it isn't possible to be sure + # this is a trailing form. + if ( 0 && !$want_brace ) { $self->warning( "syntax error at ') {', unexpected '{' after closing ')' of a trailing '$last_nonblank_token'\n" ); diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 9cb12a98..0928dd4e 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -3,7 +3,7 @@ use strict; use warnings; use Carp; use English qw( -no_match_vars ); -our $VERSION = '20230909'; +our $VERSION = '20230912'; use Perl::Tidy::VerticalAligner::Alignment; use Perl::Tidy::VerticalAligner::Line; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 7b661415..c16f5664 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -10,7 +10,7 @@ use warnings; { #<<< A non-indenting brace -our $VERSION = '20230909'; +our $VERSION = '20230912'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index 3452e353..60808a26 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20230909'; +our $VERSION = '20230912'; sub AUTOLOAD { diff --git a/t/snippets/expect/git124.def b/t/snippets/expect/git124.def new file mode 100644 index 00000000..9dc06b6b --- /dev/null +++ b/t/snippets/expect/git124.def @@ -0,0 +1,8 @@ +sub git124 { + return [ + gather while ( my $foo = $bar->foobar ) + { + ...; + } + ]; +} diff --git a/t/snippets/git124.in b/t/snippets/git124.in new file mode 100644 index 00000000..9dc06b6b --- /dev/null +++ b/t/snippets/git124.in @@ -0,0 +1,8 @@ +sub git124 { + return [ + gather while ( my $foo = $bar->foobar ) + { + ...; + } + ]; +} diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index e3c562ad..fed61293 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -397,6 +397,8 @@ ../snippets28.t xbt.xbt3 ../snippets28.t lrt.def ../snippets28.t lrt.lrt +../snippets28.t ame.ame +../snippets28.t ame.def ../snippets3.t ce_wn1.ce_wn ../snippets3.t ce_wn1.def ../snippets3.t colin.colin @@ -537,5 +539,4 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets28.t ame.ame -../snippets28.t ame.def +../snippets28.t git124.def diff --git a/t/snippets28.t b/t/snippets28.t index a2984c4c..173bee12 100644 --- a/t/snippets28.t +++ b/t/snippets28.t @@ -16,6 +16,7 @@ #13 lrt.lrt #14 ame.ame #15 ame.def +#16 git124.def # To locate test #13 you can search for its name or the string '#13' @@ -62,6 +63,17 @@ print "Tried to add: @ResolveRPM\n" if ( @ResolveRPM and !$Quiet ); print "Would need: @DepList\n" if ( @DepList and !$Quiet ); print "RPM Output:\n" unless $Quiet; print join( "\n", @RPMOutput ) . "\n" unless $Quiet; +---------- + + 'git124' => <<'----------', +sub git124 { + return [ + gather while ( my $foo = $bar->foobar ) + { + ...; + } + ]; +} ---------- 'lrt' => <<'----------', @@ -365,6 +377,21 @@ sub hello { elsif ( $level == 2 ) { $val = $global{'chapter'} } #15........... }, + + 'git124.def' => { + source => "git124", + params => "def", + expect => <<'#16...........', +sub git124 { + return [ + gather while ( my $foo = $bar->foobar ) + { + ...; + } + ]; +} +#16........... + }, }; my $ntests = 0 + keys %{$rtests}; -- 2.39.5