Handle inline comments before let correctly
commit560c498688b2189aa09ed99bc3c72c1f8e96b858
authormrkkrp <mark.karpov@tweag.io>
dateSun 21 Jul 2019, 12:22 (7 years ago)
parentde1b337
data/examples/declaration/value/function/let-multi-line-out.hs+6
@@ -10,3 +10,9 @@ bar x =
1010 y = x
1111 in z +
1212 100
13+
14+inlineComment :: Int -> Int
15+inlineComment =
16+ let {- join -} go = case () of
17+ () -> undefined
18+ in go
data/examples/declaration/value/function/let-multi-line.hs+6
@@ -10,3 +10,9 @@ bar x =
1010 y = x
1111 in z
1212 + 100
13+
14+inlineComment :: Int -> Int
15+inlineComment =
16+ let {- join -} go = case () of
17+ () -> undefined
18+ in go
src/Ormolu/Printer/Meat/Declaration/Value.hs+1−1
@@ -392,7 +392,7 @@ p_hsLocalBinds = \case
392392 (Left <$> bagToList bag) ++ (Right <$> lsigs)
393393 p_item (Left x) = located x p_valDecl'
394394 p_item (Right x) = located x p_sigDecl'
395− newlineSep p_item (sortOn ssStart items)
395+ newlineSep (sitcc . p_item) (sortOn ssStart items)
396396 HsValBinds NoExt _ -> notImplemented "HsValBinds"
397397 HsIPBinds NoExt _ -> notImplemented "HsIPBinds"
398398 EmptyLocalBinds NoExt -> return ()