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
| cond1 -> loooooooooooooooooooooooooooooong expr1
| cond2 -> loooooooooooooooooooooooooooooong expr2
#test multiwayif comment between cases
func = do
if
| abc -> yes
-- | test comment
| _ -> no

View File

@ -493,16 +493,19 @@ layoutExpr lexpr@(L _ expr) = do
|| any (\(L _ (GRHS gEpAnn _ _)) -> hasAnyCommentsBelow gEpAnn) cases
let posIf = obtainAnnPos epAnn AnnIf
layouters <- mAsk
docSetParSpacing $ docAddBaseY BrIndentRegular $ docPar
(docHandleComms posIf $ docLit $ Text.pack "if")
(layout_patternBindFinal layouters
Nothing
binderDoc
Nothing
(Right cases)
(id, Nothing)
hasComments
)
docHandleComms epAnn
$ docSetParSpacing
$ docAddBaseY BrIndentRegular
$ docPar
(docHandleComms posIf $ docLit $ Text.pack "if")
(layout_patternBindFinal layouters
Nothing
binderDoc
Nothing
(Right cases)
(id, Nothing)
hasComments
)
HsLet epAnn binds exp1 -> docHandleComms epAnn $ do
let AnnsLet spanLet spanIn = anns epAnn
let hasComments = hasAnyCommentsBelow lexpr