@@ -1,5 +1,6 @@
11-- | A formatter for Haskell source code.
22
3+{-# LANGUAGE BangPatterns #-}
34{-# LANGUAGE RecordWildCards #-}
45
56module Ormolu
@@ -55,7 +56,12 @@ ormolu cfg path str = do
5556 traceM "warnings:\n"
5657 traceM (concatMap showWarn ws)
5758 traceM (prettyPrintParseResult result0)
58− let txt = printModule (cfgDebug cfg) result0
59+ -- NOTE We're forcing 'txt' here because otherwise errors (such as
60+ -- messages about not-yet-supported functionality) will be thrown later
61+ -- when we try to parse the rendered code back, inside of GHC monad
62+ -- wrapper which will lead to error messages presenting the exceptions as
63+ -- GHC bugs.
64+ let !txt = printModule (cfgDebug cfg) result0
5965 when (not (cfgUnsafe cfg) || cfgCheckIdempotency cfg) $ do
6066 let pathRendered = path ++ "<rendered>"
6167 -- Parse the result of pretty-printing again and make sure that AST