From e794c5cc0bf590dcd40d419c78bc75425193bb64 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 7 Oct 2004 16:08:42 +0000 Subject: [PATCH] [project @ 2004-10-07 16:08:36 by simonpj] Wibbles to hi-boot files and newtypes --- ghc/compiler/iface/LoadIface.lhs | 6 ++++-- ghc/compiler/iface/MkIface.lhs | 9 +++++---- ghc/compiler/typecheck/TcRnDriver.lhs | 7 ++++--- ghc/compiler/typecheck/TcTyClsDecls.lhs | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ghc/compiler/iface/LoadIface.lhs b/ghc/compiler/iface/LoadIface.lhs index d16dc39..4ca0852 100644 --- a/ghc/compiler/iface/LoadIface.lhs +++ b/ghc/compiler/iface/LoadIface.lhs @@ -108,6 +108,8 @@ loadHiBootInterface = do { eps <- getEps ; mod <- getModule + ; traceIf (text "loadBootIface" <+> ppr mod) + -- We're read all the direct imports by now, so eps_is_boot will -- record if any of our imports mention us by way of hi-boot file ; case lookupModuleEnv (eps_is_boot eps) mod of { @@ -196,6 +198,8 @@ loadInterface doc_str mod_name from = do { -- Read the state (eps,hpt) <- getEpsAndHpt + ; traceIf (text "Considering whether to load" <+> ppr mod_name <+> ppr from) + -- Check whether we have the interface already ; case lookupIfaceByModName hpt (eps_PIT eps) mod_name of { Just iface @@ -268,8 +272,6 @@ loadInterface doc_str mod_name from mi_insts = panic "No mi_insts in PIT", mi_rules = panic "No mi_rules in PIT" } } - ; traceIf (text "Extending PTE" <+> ppr (map fst (concat new_eps_decls))) - ; updateEps_ $ \ eps -> eps { eps_PIT = extendModuleEnv (eps_PIT eps) mod final_iface, eps_PTE = addDeclsToPTE (eps_PTE eps) new_eps_decls, diff --git a/ghc/compiler/iface/MkIface.lhs b/ghc/compiler/iface/MkIface.lhs index 176dba5..355b78b 100644 --- a/ghc/compiler/iface/MkIface.lhs +++ b/ghc/compiler/iface/MkIface.lhs @@ -858,14 +858,15 @@ checkVersions source_unchanged iface -- Source code unchanged and no errors yet... carry on - -- First put the dependent-module info in the envt, just temporarily, + -- First put the dependent-module info, read from the old interface, into the envt, -- so that when we look for interfaces we look for the right one (.hi or .hi-boot) + -- -- It's just temporary because either the usage check will succeed -- (in which case we are done with this module) or it'll fail (in which -- case we'll compile the module from scratch anyhow). - ; mode <- getGhciMode - ; ifM (isOneShot mode) - (updateEps_ $ \eps -> eps { eps_is_boot = mod_deps }) + -- + -- We do this regardless of compilation mode + ; updateEps_ $ \eps -> eps { eps_is_boot = mod_deps } ; checkList [checkModUsage u | u <- mi_usages iface] } diff --git a/ghc/compiler/typecheck/TcRnDriver.lhs b/ghc/compiler/typecheck/TcRnDriver.lhs index 9d34979..1e5743a 100644 --- a/ghc/compiler/typecheck/TcRnDriver.lhs +++ b/ghc/compiler/typecheck/TcRnDriver.lhs @@ -161,9 +161,10 @@ tcRnModule hsc_env (L loc (HsModule maybe_mod exports do { -- Deal with imports; sets tcg_rdr_env, tcg_imports (rdr_env, imports) <- rnImports import_decls ; - -- In one-shot mode, record boot-file info in the EPS - ifM (isOneShot (hsc_mode hsc_env)) $ - updateEps_ (\eps -> eps { eps_is_boot = imp_dep_mods imports }) ; + -- Record boot-file info in the EPS, so that it's + -- visible to loadHiBootInterface in tcRnSrcDecls, + -- and any other incrementally-performed imports + updateEps_ (\eps -> eps { eps_is_boot = imp_dep_mods imports }) ; -- Update the gbl env updGblEnv ( \ gbl -> gbl { tcg_rdr_env = rdr_env, diff --git a/ghc/compiler/typecheck/TcTyClsDecls.lhs b/ghc/compiler/typecheck/TcTyClsDecls.lhs index a99aa2f..9662e43 100644 --- a/ghc/compiler/typecheck/TcTyClsDecls.lhs +++ b/ghc/compiler/typecheck/TcTyClsDecls.lhs @@ -115,7 +115,8 @@ tcTyAndClassDecls boot_names decls = do { -- First check for cyclic type synonysm or classes -- See notes with checkCycleErrs checkCycleErrs decls - + ; mod <- getModule + ; traceTc (text "tcTyAndCl" <+> ppr mod <+> ppr boot_names) ; (syn_tycons, alg_tyclss) <- fixM (\ ~(rec_syn_tycons, rec_alg_tyclss) -> do { let { -- Calculate variances and rec-flag ; (syn_decls, alg_decls) = partition (isSynDecl . unLoc) decls } -- 1.7.10.4