diff options
Diffstat (limited to 'ghc/GHCi/UI.hs')
-rw-r--r-- | ghc/GHCi/UI.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 10ca51124e..abb3d78fae 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -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 |