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

Precedence of certain operations is tampered by formatting. #623

Closed
bmcq-0 opened this issue Nov 28, 2022 · 1 comment · Fixed by #624
Closed

Precedence of certain operations is tampered by formatting. #623

bmcq-0 opened this issue Nov 28, 2022 · 1 comment · Fixed by #624
Labels
bug Something isn't working

Comments

@bmcq-0
Copy link

bmcq-0 commented Nov 28, 2022

The formatter currently removes necessary parentheses around certain expressions. Take the following code for example:

return (-X) ^ Y

...is formatted to:

return -X ^ Y

These expressions are NOT the same and this will lead to very obscure issues (-X ^ Y being parsed as -(X ^ Y) and not (-X) ^ Y seems to be not commonly known and will cause issues especially for beginners.

@JohnnyMorganz
Copy link
Owner

Definitely a major bug, thanks for the report. Will look to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants