Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B::Deparse: retain () around ! if omitting them would warn #22669

Open
wants to merge 2 commits into
base: blead
Choose a base branch
from

Conversation

mauke
Copy link
Contributor

@mauke mauke commented Oct 15, 2024

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.

Fixes #22661.


  • This set of changes requires a perldelta entry, and it is included.

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.

Fixes Perl#22661.
Copy link
Contributor

@jkeenan jkeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional test fails in blead, works in branch. LGTM, but since I'm not familiar with B::Deparse, additional eyeballs would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants