-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Labels
bugSomething isn't workingSomething isn't workingcommentsIssues related to comment placementIssues related to comment placement
Description
Describe the bug
If you put a Haddock comment above the record braces and format, ormolu moves the haddock comment into an illegal position.
To Reproduce
[nix-shell:~/mercury/mercury-web-backend]$ ormolu --version
ormolu 0.7.2.0
using ghc-lib-parser 9.6.6.20240701
[nix-shell:~/mercury/mercury-web-backend]$ cat src/Example.hs
module Example where
data Hello = Hello
-- | hello world
{hello :: String}
[nix-shell:~/mercury/mercury-web-backend]$ ormolu --unsafe src/Example.hs
module Example where
data Hello = Hello
{-- | hello world
hello :: String}
Compiler yells at me,
[1 of 1] Compiling Example ( src/Example.hs, interpreted ) [Source file changed]
src/Example.hs:(4,3)-(6,0): error: [GHC-21231]
unterminated `{-' at end of input
|
4 | {-- | hello world
| ^^^^^^^^^^^^^^^^^...
Expected behavior
I don't think this is a valid Haddock comment? If it isn't a valid Haddock comment then the comment shouldn't move at all. If it is considered valid, then I guess the output should be,
module Example where
data Hello = Hello
{ -- | hello world
hello :: String}
Another option might be,
module Example where
-- | hello world
data Hello = Hello
{hello :: String}
I am not a Haddock expert.
Environment
- OS name + version: PopOS, 22.04
- Version of the code: 0.7.2.0 (from nixpkgs)
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcommentsIssues related to comment placementIssues related to comment placement