Include parse-error in output-not-valid error message

ghc92
Lennart Spitzner 2023-05-09 14:30:04 +00:00
parent 7bf2879ac0
commit b057c49727
2 changed files with 3 additions and 3 deletions

View File

@ -144,7 +144,7 @@ pPrintModuleAndCheck traceFunc conf inlineConf parsedModule = do
(\_ -> return $ Right ()) (\_ -> return $ Right ())
(TextL.unpack output) (TextL.unpack output)
let errs' = errs ++ case parseResult of let errs' = errs ++ case parseResult of
Left{} -> [ErrorOutputCheck] Left x -> [ErrorOutputCheck x]
Right{} -> [] Right{} -> []
return (errs', output) return (errs', output)
@ -195,7 +195,7 @@ parsePrintModuleTests conf filename input = do
LayoutWarning str -> str LayoutWarning str -> str
ErrorUnknownNode str _ -> str ErrorUnknownNode str _ -> str
ErrorMacroConfig str _ -> "when parsing inline config: " ++ str ErrorMacroConfig str _ -> "when parsing inline config: " ++ str
ErrorOutputCheck -> "Output is not syntactically valid." ErrorOutputCheck str -> "Output is not syntactically valid: " ++ str
-- this approach would for if there was a pure GHC.parseDynamicFilePragma. -- this approach would for if there was a pure GHC.parseDynamicFilePragma.
-- Unfortunately that does not exist yet, so we cannot provide a nominally -- Unfortunately that does not exist yet, so we cannot provide a nominally
-- pure interface. -- pure interface.

View File

@ -52,7 +52,7 @@ data BrittanyError
| forall ast . (Data.Data.Data (XRec GhcPs ast), Outputable (Anno ast)) => ErrorUnknownNode String (XRec GhcPs ast) | forall ast . (Data.Data.Data (XRec GhcPs ast), Outputable (Anno ast)) => ErrorUnknownNode String (XRec GhcPs ast)
-- ^ internal error: pretty-printing is not implemented for type of node -- ^ internal error: pretty-printing is not implemented for type of node
-- in the syntax-tree -- in the syntax-tree
| ErrorOutputCheck | ErrorOutputCheck String
-- ^ checking the output for syntactic validity failed -- ^ checking the output for syntactic validity failed