summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2007-08-18 15:22:50 +0000
committerIan Lynagh <igloo@earth.li>2007-08-18 15:22:50 +0000
commita136382590fccdedd791e44599fb54b648407e2b (patch)
treef2841cbba06bd55ba7891eaa2220254c17b8d5e9
parent861cfcf09aba53e4bb20bfd1eaa23d7b5ba14e76 (diff)
downloadhaskell-a136382590fccdedd791e44599fb54b648407e2b.tar.gz
Fix trac #1565: :r DoesNotExist needs to remove any let-bound values
-rw-r--r--compiler/main/GHC.hs13
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 506a839b14..bf276d5995 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -273,7 +273,7 @@ import Control.Exception as Exception hiding (handle)
import Data.IORef
import System.IO
import System.IO.Error ( try, isDoesNotExistError )
-import Prelude hiding (init)
+import Prelude hiding (init, catch)
-- -----------------------------------------------------------------------------
@@ -539,9 +539,16 @@ load s@(Session ref) how_much
-- graph is still retained in the Session. We can tell which modules
-- were successfully loaded by inspecting the Session's HPT.
mb_graph <- depanal s [] False
- case mb_graph of
- Just mod_graph -> load2 s how_much mod_graph
+ case mb_graph of
+ Just mod_graph -> catchingFailure $ load2 s how_much mod_graph
Nothing -> return Failed
+ where catchingFailure f = f `catch` \e -> do
+ hsc_env <- readIORef ref
+ -- trac #1565 / test ghci021:
+ -- let bindings may explode if we try to use them after
+ -- failing to reload
+ writeIORef ref $! hsc_env{ hsc_IC = emptyInteractiveContext }
+ throw e
load2 s@(Session ref) how_much mod_graph = do
guessOutputFile s