-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Ormolu gobbles up the semicolons from or patterns that span multiple lines, resulting in this error (code below):
repro.hs
@@ -3,8 +3,10 @@
data Foo = A | B | C | D deriving (Show)
- food foo@(A;
- B;
- C) = Just foo
+ food
+ foo@( A
+ B
+ C
+ ) = Just foo
food _ = Nothing
main = mapM (print . food) [A, B, C, D]
AST of input and AST of formatted code differ.
at repro.hs:(5,11)-(7,11)
Please, consider reporting the bug.
To format anyway, use --unsafe.Running the code before formatting works just fine.
$ runhaskell repro.hs
Just A
Just B
Just C
NothingAnd as the error message implies, running the formatted (with --unsafe) code doesn't work, because the semicolon isn't redundant in or patterns.
$ ormolu --unsafe -i repro.hs && runhaskell repro.hs
repro.hs:6:9: error: [GHC-27346]
• The data constructor ‘A’ should have no arguments, but has been given 2
• In the pattern: A B C
In an equation for ‘food’: food foo@(A B C) = Just foo
|
6 | foo@( A
| ^...To Reproduce
Run Ormolu on:
{-# LANGUAGE OrPatterns #-}
data Foo = A | B | C | D deriving (Show)
food foo@(A;
B;
C) = Just foo
food _ = Nothing
main = mapM (print . food) [A, B, C, D]Expected behavior
The semicolons stay; or more specifically, Ormolu doesn't error.
Environment
- OS name + version: Arch Linux (rolling release)
- Version of the code: reproduces on both 0.8.0.2 and 8d609ae (latest commit at time of writing)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working