Commit 10faf44d authored by Matthew Pickering's avatar Matthew Pickering Committed by Ben Gamari

Don't overwrite the set log_action when using --interactive

-ddump-json didn't work with --interactive as --interactive overwrote
the log_action in terms of defaultLogAction.

Reviewers: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14078

Differential Revision: https://phabricator.haskell.org/D4533
parent e7164384
......@@ -445,7 +445,10 @@ interactiveUI config srcs maybe_exprs = do
lastErrLocationsRef <- liftIO $ newIORef []
progDynFlags <- GHC.getProgramDynFlags
_ <- GHC.setProgramDynFlags $
progDynFlags { log_action = ghciLogAction lastErrLocationsRef }
-- Ensure we don't override the user's log action lest we break
-- -ddump-json (#14078)
progDynFlags { log_action = ghciLogAction (log_action progDynFlags)
lastErrLocationsRef }
when (isNothing maybe_exprs) $ do
-- Only for GHCi (not runghc and ghc -e):
......@@ -536,9 +539,10 @@ resetLastErrorLocations = do
st <- getGHCiState
liftIO $ writeIORef (lastErrorLocations st) []
ghciLogAction :: IORef [(FastString, Int)] -> LogAction
ghciLogAction lastErrLocations dflags flag severity srcSpan style msg = do
defaultLogAction dflags flag severity srcSpan style msg
ghciLogAction :: LogAction -> IORef [(FastString, Int)] -> LogAction
ghciLogAction old_log_action lastErrLocations
dflags flag severity srcSpan style msg = do
old_log_action dflags flag severity srcSpan style msg
case severity of
SevError -> case srcSpan of
RealSrcSpan rsp -> modifyIORef lastErrLocations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment