You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description !$something == $else throws warnings with perl 5.41.x. B::Deparse may generate code which triggers this warning.
Steps to Reproduce
Sample oneliner:
$ perl5.41.4 -w -MO=Deparse -e 'my $p; if ((!$p) == 1) { }' | perl5.41.4 -cw
-e syntax OK
Possible precedence problem between ! and numeric eq (==) at - line 3.
- syntax OK
Output produced by B::Deparse is here:
BEGIN { $^W = 1; }
my $p;
if (!$p == 1) {
();
}
-e syntax OK
Expected behavior B::Deparse should not drop the parentheses in this example
Perl configuration
Seen with normally compiled 5.41.4
The text was updated successfully, but these errors were encountered:
Description!$something == $else throws warnings with perl 5.41.x. B::Deparse may generate code which triggers this warning.
Steps to Reproduce Sample oneliner:
$ perl5.41.4 -w -MO=Deparse -e 'my $p; if ((!$p) == 1) { }' | perl5.41.4 -cw
-e syntax OK
Possible precedence problem between ! and numeric eq (==) at - line 3.
- syntax OK
Since 570fa43, we emit precedence warnings if the LHS of a comparison
or binding op starts with an unparenthesized logical negation (`!`, as
in `!$x == $y`). Explicit parens can be used to avoid the warning
(`(!$x) == $y`).
Teach B::Deparse to keep these parentheses even if they're not strictly
required by operator precedence because we don't want the deparsed code
to generate more warnings than the original code.
FixesPerl#22661.
Module: B::Deparse
Description
!$something == $else
throws warnings with perl 5.41.x.B::Deparse
may generate code which triggers this warning.Steps to Reproduce
Sample oneliner:
Output produced by
B::Deparse
is here:Expected behavior
B::Deparse
should not drop the parentheses in this examplePerl configuration
Seen with normally compiled 5.41.4
The text was updated successfully, but these errors were encountered: