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

Improve printing of nested expressions #5918

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fingolfin
Copy link
Member

Specifically, make it better at eliding redundant parenthesis. We do so by changing the code so that the PrintPrecedence is reset to 0 whenever a expression is print that is not a unary or binary op, and then restored afterwards. For "leave" expressions such as integer literals this has no effect. But for expression that can have further subexpressions, such as function expressions, list expression, permutation expressions etc., this allows us to avoid redundant parenthesis.

Resolves #4523 by @zickgraf

Specifically, make it better at eliding redundant parenthesis. We
do so by changing the code so that the PrintPrecedence is reset to
0 whenever a expression is print that is not a unary or binary op,
and then restored afterwards. For "leave" expressions such as
integer literals this has no effect. But for expression that can
have further subexpressions, such as function expressions, list
expression, permutation expressions etc., this allows us to avoid
redundant parenthesis.
@fingolfin fingolfin added topic: kernel release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected parentheses when displaying certain functions
1 participant