diff options
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 7 | ||||
-rw-r--r-- | utils/check-exact/Transform.hs | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index a3b0ab2a40..0124bf46b6 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -1448,13 +1448,14 @@ instance ExactPrint (HsModule GhcPs) where return (an1, Just m', mdeprec', mexports') - -- Get rid of the balance of the header comments - -- cs <- getUnallocatedComments - -- flushComments [] let ann_decls = EpAnn (entry an) (am_decls $ anns an0) emptyComments (ann_decls', (decls', imports')) <- markAnnList' False ann_decls $ do imports' <- markTopLevelList imports + + -- Get rid of the balance of the header comments + flushComments [] + decls' <- markTopLevelList decls -- Need to add trailing comments that may come before the final `}` addCommentsA $ getFollowingComments (comments an) diff --git a/utils/check-exact/Transform.hs b/utils/check-exact/Transform.hs index ca23eab794..a446eac45b 100644 --- a/utils/check-exact/Transform.hs +++ b/utils/check-exact/Transform.hs @@ -666,8 +666,10 @@ balanceComments' la1 la2 = do simpleBreak n (r,_) = r > n L (SrcSpanAnn an1 loc1) f = la1 L (SrcSpanAnn an2 loc2) s = la2 - anc1 = addCommentOrigDeltas $ epAnnComments an1 - anc2 = addCommentOrigDeltas $ epAnnComments an2 + -- anc1 = addCommentOrigDeltas $ epAnnComments an1 + -- anc2 = addCommentOrigDeltas $ epAnnComments an2 + anc1 = epAnnComments an1 + anc2 = epAnnComments an2 cs1s = splitCommentsEnd (anchorFromLocatedA la1) anc1 `debug` ("balanceComments': (anc1, anc2):" ++ showAst (anc1, anc2)) @@ -941,7 +943,7 @@ insertAt f t decl = do -- let oldDecls'' = captureLineSpacing oldDeclsb -- `debug` ("oldDecls':" ++ showAst oldDecls') r <- replaceDecls t (f decl oldDecls) - -- `debug` ("oldDecls'':" ++ showAst oldDecls'') + `debug` ("oldDeclsb:" ++ showAst oldDeclsb) return r -- |Insert a declaration at the beginning or end of the subdecls of the given |