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

-(-expression) gets printed incorrectly #827

Open
lue-bird opened this issue Dec 22, 2024 · 0 comments
Open

-(-expression) gets printed incorrectly #827

lue-bird opened this issue Dec 22, 2024 · 0 comments

Comments

@lue-bird
Copy link

lue-bird commented Dec 22, 2024

-(-1) or any other doubly negated expression like -(-a) gets turned into a single-line comment --1 or --a.
The only exception is -(-0) which first gets turned into -0 and on next format turned into 0.

In the first cases, the parens should be preserved. The -(-0) should directly be converted to 0.
Given, this is an extremely rare edge case.

Here's how I implemented it for elm-syntax: https://github.com/lue-bird/elm-syntax-format/blob/main/src/ElmSyntaxPrintDefunctionalized.elm#L5355-L5406

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

No branches or pull requests

1 participant