summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/main/HscMain.lhs5
-rw-r--r--compiler/main/InteractiveEval.hs8
-rw-r--r--compiler/typecheck/TcRnDriver.lhs11
3 files changed, 15 insertions, 9 deletions
diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs
index 46a46a7b41..6c349166a1 100644
--- a/compiler/main/HscMain.lhs
+++ b/compiler/main/HscMain.lhs
@@ -307,10 +307,7 @@ hscRnImportDecls
-- because tcRnImports will force-load any orphan modules necessary, making extra
-- instances/family instances visible (GHC #4832)
hscRnImportDecls hsc_env import_decls
- = runHsc hsc_env $ ioMsgMaybe $
- initTc hsc_env HsSrcFile False iNTERACTIVE $ -- iNTERACTIVE, see #5545
- fmap tcg_rdr_env $
- tcRnImports hsc_env iNTERACTIVE import_decls
+ = runHsc hsc_env $ ioMsgMaybe $ tcRnImportDecls hsc_env import_decls
#endif
-- -----------------------------------------------------------------------------
diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 4e100db485..0fd710a7eb 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -803,12 +803,12 @@ fromListBL bound l = BL (length l) bound l []
setContext :: GhcMonad m => [InteractiveImport] -> m ()
setContext imports
= do { hsc_env <- getSession
- ; let old_ic = hsc_IC hsc_env
; all_env <- liftIO $ findGlobalRdrEnv hsc_env imports
- ; let final_rdr_env = ic_tythings old_ic `icPlusGblRdrEnv` all_env
+ ; let old_ic = hsc_IC hsc_env
+ final_rdr_env = ic_tythings old_ic `icPlusGblRdrEnv` all_env
; modifySession $ \_ ->
- hsc_env{ hsc_IC = old_ic { ic_imports = imports
- , ic_rn_gbl_env = final_rdr_env }}}
+ hsc_env{ hsc_IC = old_ic { ic_imports = imports
+ , ic_rn_gbl_env = final_rdr_env }}}
findGlobalRdrEnv :: HscEnv -> [InteractiveImport] -> IO GlobalRdrEnv
-- Compute the GlobalRdrEnv for the interactive context
diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs
index 4ef4ea700e..8af5632ec1 100644
--- a/compiler/typecheck/TcRnDriver.lhs
+++ b/compiler/typecheck/TcRnDriver.lhs
@@ -8,11 +8,11 @@
module TcRnDriver (
#ifdef GHCI
tcRnStmt, tcRnExpr, tcRnType,
+ tcRnImportDecls,
tcRnLookupRdrName,
getModuleInterface,
tcRnDeclsi,
#endif
- tcRnImports,
tcRnLookupName,
tcRnGetInfo,
tcRnModule,
@@ -1402,6 +1402,15 @@ tcRnExpr hsc_env ictxt rdr_expr
let { all_expr_ty = mkForAllTys qtvs (mkPiTypes dicts res_ty) } ;
zonkTcType all_expr_ty
}
+
+--------------------------
+tcRnImportDecls :: HscEnv
+ -> [LImportDecl RdrName]
+ -> IO (Messages, Maybe GlobalRdrEnv)
+tcRnImportDecls hsc_env import_decls
+ = initTcPrintErrors hsc_env iNTERACTIVE $
+ do { gbl_env <- tcRnImports hsc_env iNTERACTIVE import_decls
+ ; return (tcg_rdr_env gbl_env) }
\end{code}
tcRnType just finds the kind of a type