1
1
mirror of https://github.com/google/ormolu.git synced 2024-09-11 08:05:24 +03:00

Fix rendering of type signatures concerning several identifiers

Previously an extra space were erroneously inserted if the first identifier
happened to be one character long.
This commit is contained in:
Mark Karpov 2020-04-26 22:36:58 +02:00
parent 83d6dcbc15
commit ae789a41b0
3 changed files with 19 additions and 4 deletions

View File

@ -2,6 +2,11 @@ foo, bar :: Int
foo = 1
bar = 2
a, b, c :: Int
a = 1
b = 2
c = 3
foo,
bar,
baz ::

View File

@ -2,6 +2,11 @@ foo, bar :: Int
foo = 1
bar = 2
a, b, c :: Int
a = 1
b = 2
c = 3
foo,
bar,
baz :: Int

View File

@ -48,11 +48,12 @@ p_typeSig indentTail (n : ns) hswc = do
p_rdrName n
if null ns
then p_typeAscription hswc
else bool id inci indentTail $ do
else do
comma
breakpoint
sep (comma >> breakpoint) p_rdrName ns
p_typeAscription hswc
bool id inci indentTail $ do
sep (comma >> breakpoint) p_rdrName ns
p_typeAscription hswc
p_typeAscription ::
LHsSigWcType GhcPs ->
@ -74,7 +75,11 @@ p_patSynSig ::
R ()
p_patSynSig names hsib = do
txt "pattern"
let body = p_typeSig False names HsWC {hswc_ext = NoExtField, hswc_body = hsib}
let body =
p_typeSig
False
names
HsWC {hswc_ext = NoExtField, hswc_body = hsib}
if length names > 1
then breakpoint >> inci body
else space >> body