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

Idempotence issue with comments #512

Closed
judah opened this issue Feb 13, 2020 · 1 comment · Fixed by #576
Closed

Idempotence issue with comments #512

judah opened this issue Feb 13, 2020 · 1 comment · Fixed by #576
Assignees
Labels
bug Something isn't working comments Issues related to comment placement idempotence Idempotence issues and solutions.

Comments

@judah
Copy link

judah commented Feb 13, 2020

This is another case where Ormolu's handling of comments is non-idempotent. I'm filing it as a separate issue from #340 because it doesn't seem related to matches, and also seems more sensitive to the exact input than usual.

Original input:

x  =
      y ++ -- commentA
-- commentB
      f g -- commentC

The first run of Ormolu produces:

x =
  y
    ++ f g -- commentA
    -- commentB
      -- commentC

The second run produces:

x =
  y
    ++ f g -- commentA
      -- commentB
      -- commentC
@judah
Copy link
Author

judah commented Feb 13, 2020

Also, on second look, the moving of commentB above f g also seems suspect.

As another example, if I replace f g with f then the result is idempotent:

x =
  y
    ++ f -- commentA
    -- commentB
    -- commentC

and the steady-state picks a different indentation for commentB and commentC than in the original example.

@mrkkrp mrkkrp added bug Something isn't working idempotence Idempotence issues and solutions. comments Issues related to comment placement labels Feb 13, 2020
@mrkkrp mrkkrp self-assigned this Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comments Issues related to comment placement idempotence Idempotence issues and solutions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants