X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FGHC.hs;h=1fc360550610223fc43c007f3f68728fc3c1097d;hb=eb4352ab0675309fe6cb1ad38cf070340a338e50;hp=506a839b1414183293e3c9318de3d92c93a23706;hpb=68a8c3bbab3a77a982fcac980e69f47b4ec13dfd;p=ghc-hetmet.git diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 506a839..1fc3605 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -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 `Exception.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 @@ -1980,4 +1987,4 @@ findModule' hsc_env mod_name maybe_pkg = getHistorySpan :: Session -> History -> IO SrcSpan getHistorySpan sess h = withSession sess $ \hsc_env -> return$ InteractiveEval.getHistorySpan hsc_env h -#endif \ No newline at end of file +#endif