Skip to content

Commit

Permalink
GHC 9.10: disable error index links when printing exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyl20 committed Jul 31, 2024
1 parent f930eaa commit 7725a21
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/GhcUtil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import System.Exit (exitFailure)
import StaticFlags (discardStaticFlags)
#endif

#if __GLASGOW_HASKELL__ >= 910
import GHC.Data.Bool (OverridingBool(..))
#endif

-- Catch GHC source errors, print them and exit.
handleSrcErrors :: Ghc a -> Ghc a
handleSrcErrors action' = flip handleSourceError action' $ \err -> do
Expand Down Expand Up @@ -58,7 +62,18 @@ handleDynamicFlags flags = do
#else
let parseDynamicFlags' = parseDynamicFlags
#endif
(dynflags, locSrcs, _) <- (setHaddockMode `fmap` getSessionDynFlags) >>= (`parseDynamicFlags'` flags)
(dynflags', locSrcs, _) <- (setHaddockMode `fmap` getSessionDynFlags) >>= (`parseDynamicFlags'` flags)

#if __GLASGOW_HASKELL__ >= 910
-- never display error links when displaying exception. Otherwise we get
-- failures like this:
-- expected: "Foo.hs:6:1: error: [GHC-58481]\n parse error..."
-- but got: "Foo.hs:6:1: error: [\ESC]8;;https://errors.haskell.org/messages/GHC-58481\ESC\\GHC-58481\ESC]8;;\ESC\\]\n parse error..."
let dynflags = dynflags' { useErrorLinks = Never }
#else
let dynflags = dynflags'
#endif

_ <- setSessionDynFlags dynflags

-- We basically do the same thing as `ghc/Main.hs` to distinguish
Expand Down

0 comments on commit 7725a21

Please sign in to comment.