It doesn't make sense to warn 'Parentheses missing around "my" list' if
adding the parens causes a syntax error (you can't declare typeglobs).
But it does make sense to warn for 'local $foo, *bar' because typeglobs
can be localized.
Thus modify the heuristic to only warn for '*' if we're not lexically
declaring something.
s++;
while (1) {
- if (*s && strchr("@$%*", *s) && *++s
+ if (*s && (strchr("@$%", *s) || (!lex && *s == '*'))
+ && *++s
&& (isWORDCHAR(*s) || UTF8_IS_CONTINUED(*s))) {
s++;
sigil = TRUE;
my $a, $b = (1,2);
my @foo,%bar, $quux; # there's a TAB here
my $x, $y or print;
+my $p, *q;
no warnings 'parenthesis' ;
my $c, $d = (1,2);
EXPECT
# op.c
use warnings 'parenthesis' ;
our $a, $b = (1,2);
+our $p, *q;
no warnings 'parenthesis' ;
our $c, $d = (1,2);
EXPECT
use warnings 'parenthesis' ;
local $a, $b = (1,2);
local *f, *g;
+local $p, *q;
no warnings 'parenthesis' ;
local $c, $d = (1,2);
EXPECT
Parentheses missing around "local" list at - line 3.
Parentheses missing around "local" list at - line 4.
+Parentheses missing around "local" list at - line 5.
########
# op.c
use warnings 'bareword' ;