Skip to content

Commit 18d92b5

Browse files
amesgenmrkkrp
authored andcommitted
Fix formatting single-line MultiWayIfs
1 parent 629c486 commit 18d92b5

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
* Make multiline function signatures in RequiredTypeArguments consistent with
1212
types [PR 1170](https://github.com/tweag/ormolu/pull/1170)
1313

14+
* Correctly format single-line `MultiWayIf`s. [Issue
15+
1171](https://github.com/tweag/ormolu/issues/1171).
16+
1417
## Ormolu 0.8.0.0
1518

1619
* Format multiple files in parallel. [Issue

data/examples/declaration/value/function/multi-way-if-out.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ baz =
1414
| p -> f
1515
| otherwise -> g
1616
x
17+
18+
x y = if | foo -> False | otherwise -> True

data/examples/declaration/value/function/multi-way-if.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ baz =
1212
if | p -> f
1313
| otherwise -> g
1414
x
15+
16+
x y = if | foo -> False | otherwise -> True

src/Ormolu/Printer/Meat/Declaration/Value.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ p_hsExpr' isApp s = \case
733733
HsMultiIf _ guards -> do
734734
txt "if"
735735
breakpoint
736-
inciApplicand isApp $ sep newline (located' (p_grhs RightArrow)) guards
736+
inciApplicand isApp $ sep breakpoint (located' (p_grhs RightArrow)) guards
737737
HsLet _ localBinds e ->
738738
p_let p_hsExpr localBinds e
739739
HsDo _ doFlavor es -> do

0 commit comments

Comments
 (0)