1
1
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:
Utku Demir 2019-08-27 19:00:57 +12:00 committed by Mark Karpov
parent e5b99e8e66
commit 721ba7e367
3 changed files with 27 additions and 1 deletions

View 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

View 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 } }

View File

@ -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) ->