ormolu
ormolu copied to clipboard
Idempotency issue with comment between case and where clause
$ cat repro.hs
foo =
case x of
_ -> 1
-- comment
where
x = 1
$ ormolu -c repro.hs
repro.hs
@@ -1,6 +1,7 @@
foo =
case x of
_ -> 1
- -- comment
where
+ -- comment
+
x = 1
Formatting is not idempotent.
Please, consider reporting the bug.
$ ormolu --version
ormolu 0.3.0.0 HEAD 06b767c8b70e60321a4debc4599127446f958e5b
using ghc-lib-parser 9.0.1.20210324
Note that the issue goes away when moving the case
up:
$ cat good.hs
foo = case x of
_ -> 1
-- comment
where
x = 1
$ ormolu -c good.hs
foo = case x of
_ -> 1
-- comment
where
x = 1
Thanks for your reports! If you found them by applying Ormolu to a particular project, and it is open source, we could add it to the set of packages which are automatically tested on CI.
I found these bugs by running ormolu on closed source code, but feel free to use my minimal repros in your tests.