mirror of
https://github.com/google/ormolu.git
synced 2024-11-27 13:13:23 +03:00
Only force braces on hsLocalBinds on a single-line layout
This commit is contained in:
parent
e5b99e8e66
commit
721ba7e367
12
data/examples/declaration/value/function/where-nested-out.hs
Normal file
12
data/examples/declaration/value/function/where-nested-out.hs
Normal file
@ -0,0 +1,12 @@
|
||||
foo = bar
|
||||
where
|
||||
f1 = f1
|
||||
where
|
||||
f1 = 3
|
||||
f2 = f2
|
||||
where
|
||||
f2 = 3
|
||||
|
||||
foo2 = bar
|
||||
where
|
||||
f1 = f1 where { f1 = 3; f1' = 4 }; f2 = f2 where f2 = 3; f2' = 4
|
13
data/examples/declaration/value/function/where-nested.hs
Normal file
13
data/examples/declaration/value/function/where-nested.hs
Normal file
@ -0,0 +1,13 @@
|
||||
foo = bar
|
||||
where
|
||||
f1 = f1
|
||||
where
|
||||
f1 = 3
|
||||
f2 = f2
|
||||
where
|
||||
f2 = 3
|
||||
|
||||
foo2 = bar
|
||||
where
|
||||
{ f1 = f1 where { f1 = 3; f1' = 4 }; f2 = f2 where { f2 = 3; f2' = 4 } }
|
||||
|
@ -420,8 +420,9 @@ p_hsLocalBinds = \case
|
||||
-- NOTE When in a single-line layout, there is a chance that the inner
|
||||
-- elements will also contain semicolons and they will confuse the
|
||||
-- parser. so we request braces around every element except the last.
|
||||
br <- vlayout (return useBraces) (return id)
|
||||
sitcc $ sepSemi
|
||||
(\(m, i) -> (if m then useBraces else id) $ p_item i)
|
||||
(\(m, i) -> (if m then br else id) $ p_item i)
|
||||
(markInit $ sortOn ssStart items)
|
||||
HsValBinds NoExt _ -> notImplemented "HsValBinds"
|
||||
HsIPBinds NoExt (IPBinds NoExt xs) ->
|
||||
|
Loading…
Reference in New Issue
Block a user