Fix handling of EOF

pull/357/head
Taylor Fausak 2021-11-06 15:19:38 +00:00 committed by GitHub
parent 1ad34aedcc
commit 8290109e7f
1 changed files with 3 additions and 3 deletions

View File

@ -313,7 +313,7 @@ parsePrintModule configWithDebugs inputText = runExceptT $ do
True -> not $ null errsWarns True -> not $ null errsWarns
if hasErrors if hasErrors
then throwE $ errsWarns then throwE $ errsWarns
else pure $ TextL.toStrict $ TextL.snoc outputTextL '\n' else pure $ TextL.toStrict outputTextL
@ -398,7 +398,7 @@ parsePrintModuleTests conf filename input = do
else lift else lift
$ pPrintModuleAndCheck moduleConf perItemConf anns parsedModule $ pPrintModuleAndCheck moduleConf perItemConf anns parsedModule
if null errs if null errs
then pure $ TextL.toStrict $ TextL.snoc ltext '\n' then pure $ TextL.toStrict ltext
else else
let let
errStrs = errs <&> \case errStrs = errs <&> \case
@ -497,7 +497,7 @@ ppModule lmod@(L _loc _m@(HsModule _ _name _exports _ decls _ _)) = do
(ExactPrint.AnnComment (ExactPrint.Comment cmStr _ _), l) -> do (ExactPrint.AnnComment (ExactPrint.Comment cmStr _ _), l) -> do
ppmMoveToExactLoc l ppmMoveToExactLoc l
mTell $ Text.Builder.fromString cmStr mTell $ Text.Builder.fromString cmStr
(ExactPrint.G _, (ExactPrint.DP (eofZ, eofX))) -> (ExactPrint.AnnEofPos, (ExactPrint.DP (eofZ, eofX))) ->
let folder (acc, _) (kw, ExactPrint.DP (y, x)) = case kw of let folder (acc, _) (kw, ExactPrint.DP (y, x)) = case kw of
ExactPrint.AnnComment cm ExactPrint.AnnComment cm
| span <- ExactPrint.commentIdentifier cm | span <- ExactPrint.commentIdentifier cm