On Mon Jan 27 18:06:12 2020, PEVANS wrote:
Show quoted text> Ah; I suspect a bug in the lexer extension for parsing attributes. It
> accepts whitespace between the attribute name and parenthesized
> argument string, which it isn't supposed to.
Yup. Turns out to be a simple fix by removing a line of code.
$ perl -Mblib -c rt131571.pl
rt131571.pl syntax OK
Patch attached.
--
Paul Evans
=== modified file 'hax/lexer-additions.c.inc'
--- old/hax/lexer-additions.c.inc 2019-12-01 01:44:11 +0000
+++ new/hax/lexer-additions.c.inc 2020-01-28 00:05:18 +0000
@@ -78,7 +78,7 @@
if(!ret)
return ret;
- lex_read_space(0);
+ /* Do not read space here as space is not allowed between NAME(ARGS) */
if(lex_peek_unichar(0) != '(')
return ret;
=== modified file 't/44sub-attrs.t'
--- old/t/44sub-attrs.t 2019-07-05 14:27:39 +0000
+++ new/t/44sub-attrs.t 2020-01-28 00:05:18 +0000
@@ -34,6 +34,8 @@
# some custom ones
{
+ package TestCustomAttrs;
+
my $modify_invoked;
sub MODIFY_CODE_ATTRIBUTES
@@ -41,13 +43,23 @@
my ( $pkg, $sub, $attr ) = @_;
$modify_invoked++;
- is( $attr, "MyCustomAttribute(value here)", 'MODIFY_CODE_ATTRIBUTES takes attr' );
+ ::is( $attr, "MyCustomAttribute(value here)", 'MODIFY_CODE_ATTRIBUTES takes attr' );
return ();
}
async sub is_attributed :MyCustomAttribute(value here) { }
- ok( $modify_invoked, 'MODIFY_CODE_ATTRIBUTES invoked' );
+ ::ok( $modify_invoked, 'MODIFY_CODE_ATTRIBUTES invoked' );
+}
+
+# RT131571
+{
+ ok( defined eval q{
+ use experimental 'signatures';
+ async sub func :method ($self, @args) { }
+ 1;
+ }, 'signatures do not leak into attributes (RT131571)' ) or
+ diag( "Error was $@" );
}
done_testing;