Fix comment-after-context

ghc92
Lennart Spitzner 2023-04-19 11:52:45 +00:00
parent b24379d104
commit 09ec59eaf9
2 changed files with 18 additions and 5 deletions

View File

@ -929,3 +929,10 @@ alignColsLines layoutBriDocM bridocs = do -- colInfos `forM_` \colInfo -> do
-- contains nonempty Seqs.
colAggregation xs = maximum [ x | x <- xs, x <= minimum xs + alignMax' ]
where alignMax' = max 0 alignMax
#test type-signature comment-after-context
tzejubuVxairoy
:: (VwzuyApikd.VwzuyApikd zub, ZxtbaKospaKwqnuw Defg.Xeqpgko.Xeqpgko m)
-- foo bar
=> CUR.Ozuzcak zub
-> m ()

View File

@ -37,12 +37,18 @@ splitArrowType ltype@(L _ typ) = case typ of
splitHsForallTypeFromBinders (getBinders hsf) typ1
HsQualTy NoExtField ctxMay typ1 -> do
(innerHead, innerBody) <- splitArrowType typ1
(wrapCtx, cntxtDocs) <- case ctxMay of
Nothing -> pure (id, [])
Just (L (SrcSpanAnn epAnn _) ctxs) -> do
let wrap = case epAnn of
EpAnn _ (AnnContext (Just (_, loc)) _ _) _ ->
docFlushCommsPost False (Just $ epaLocationRealSrcSpanStart loc)
. docHandleComms epAnn
_ -> docHandleComms epAnn
x <- ctxs `forM` (shareDoc . layoutType)
pure (wrap, x)
pure
$ ( do
cntxtDocs <- case ctxMay of
Nothing -> pure []
Just (L _ ctxs) -> ctxs `forM` (shareDoc . layoutType)
case cntxtDocs of
$ ( wrapCtx $ case cntxtDocs of
[] -> docLit $ Text.pack "()"
[x] -> x
docs -> docAlt