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

Idempotency check fails for comment plus record syntax #936

Open
joncol opened this issue Nov 10, 2022 · 1 comment
Open

Idempotency check fails for comment plus record syntax #936

joncol opened this issue Nov 10, 2022 · 1 comment
Labels
bug Something isn't working comments Issues related to comment placement idempotence Idempotence issues and solutions.

Comments

@joncol
Copy link

joncol commented Nov 10, 2022

Describe the bug
Idempotency check fails for comment plus record syntax.

To Reproduce
The simplest piece of code I could come up with that causes the idempotency check to fail:

data X = X { x :: Int }

f = id
    . -- Some comment
    (\s -> s { x = 1 })

Expected behavior
Idempotency check should succeed.

Environment
Ormolu Live:
Version 0.5.0.1, commit [54642a7](https://github.com/tweag/ormolu/commit/54642a7966d1d0787ba84636a2eb52f6729f600e), using ghc-lib-parser 9.4.2.20220822

  • Version of the code:
    See above.

I'm not sure if this is covered by some already existing bug...?

@amesgen amesgen added idempotence Idempotence issues and solutions. comments Issues related to comment placement labels Nov 10, 2022
@mrkkrp mrkkrp added the bug Something isn't working label Feb 22, 2023
@brandonchinn178
Copy link
Collaborator

Error output:

<input>
@@ -1,4 +1,9 @@
  f =
    id
-     . (\s -> s {x -- Some comment
-                 = 1})
+     . ( \s ->
+           s
+             { x -- Some comment
+               =
+                 1
+             }
+       )

  Formatting is not idempotent.
  Please, consider reporting the bug.

So primary issue is the comment floating into the lambda

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

No branches or pull requests

4 participants