Fix a missing comment case with MultiWayIf

ghc92
Lennart Spitzner 2023-05-29 22:59:16 +02:00
parent 03e578f72c
commit 4ed3a2f53d
2 changed files with 20 additions and 10 deletions

View File

@ -14,3 +14,10 @@ func = do
bar $ if bar $ if
| cond1 -> loooooooooooooooooooooooooooooong expr1 | cond1 -> loooooooooooooooooooooooooooooong expr1
| cond2 -> loooooooooooooooooooooooooooooong expr2 | cond2 -> loooooooooooooooooooooooooooooong expr2
#test multiwayif comment between cases
func = do
if
| abc -> yes
-- | test comment
| _ -> no

View File

@ -493,7 +493,10 @@ layoutExpr lexpr@(L _ expr) = do
|| any (\(L _ (GRHS gEpAnn _ _)) -> hasAnyCommentsBelow gEpAnn) cases || any (\(L _ (GRHS gEpAnn _ _)) -> hasAnyCommentsBelow gEpAnn) cases
let posIf = obtainAnnPos epAnn AnnIf let posIf = obtainAnnPos epAnn AnnIf
layouters <- mAsk layouters <- mAsk
docSetParSpacing $ docAddBaseY BrIndentRegular $ docPar docHandleComms epAnn
$ docSetParSpacing
$ docAddBaseY BrIndentRegular
$ docPar
(docHandleComms posIf $ docLit $ Text.pack "if") (docHandleComms posIf $ docLit $ Text.pack "if")
(layout_patternBindFinal layouters (layout_patternBindFinal layouters
Nothing Nothing