From ff8ad7e42e9d2111431fd9afbf2c4e42af54f776 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 3 Nov 2021 17:31:06 -0700 Subject: [PATCH] fix b1234.in, make token type after '->' consistent --- dev-bin/run_convergence_tests.pl.data | 27 +++++++++++++++++++++++++++ lib/Perl/Tidy/Tokenizer.pm | 9 ++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 90ce7ec1..ba7b5939 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -7853,6 +7853,33 @@ $obj= {foo => sub { "bar" ; } --paren-vertical-tightness=1 --weld-nested-containers +==> b1234.in <== +# S1 +is( + Pack-> + $mname( + "a", "b", + "c" + ), +"method,a,b,c" +); + +# S2 +is( + Pack->$mname + ( + "a", "b", + "c" + ), +"method,a,b,c" +); + +==> b1234.par <== +--continuation-indentation=10 +--ignore-old-breakpoints +--maximum-line-length=12 +--variable-maximum-line-length + ==> b1236.in <== # Added level test when applying kpit # S1 diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 0d3ef5d7..64d3ded2 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -7649,7 +7649,14 @@ EOM if ($saw_type) { if ($saw_alpha) { - if ( $identifier =~ /^->/ && $last_nonblank_type eq 'w' ) { + + # The type without the -> should be the same as with the -> so + # that if they get separated we get the same bond strengths, + # etc. See b1234 + if ( $identifier =~ /^->/ + && $last_nonblank_type eq 'w' + && substr( $identifier, 2, 1 ) =~ /^\w/ ) + { $type = 'w'; } else { $type = 'i' } -- 2.39.5