From: simonpj Date: Tue, 15 Oct 2002 11:52:32 +0000 (+0000) Subject: [project @ 2002-10-15 11:52:31 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~1544 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=5c614bc5f79ac6134e081e71c5db97495e52e1e2;p=ghc-hetmet.git [project @ 2002-10-15 11:52:31 by simonpj] ------------------------------------------------ Fix exports for a module with no local bindings ------------------------------------------------ Fix the export-list generation for a module with no local bindings. This one bug was breaking a bunch of modxxx tests, plus some renamer test, plus a desugarer test. --- diff --git a/ghc/compiler/typecheck/TcRnDriver.lhs b/ghc/compiler/typecheck/TcRnDriver.lhs index 6e146f4..e3858d0 100644 --- a/ghc/compiler/typecheck/TcRnDriver.lhs +++ b/ghc/compiler/typecheck/TcRnDriver.lhs @@ -145,7 +145,7 @@ tcRnModule hsc_env pcs do { -- Deal with imports; sets tcg_rdr_env, tcg_imports (rdr_env, imports) <- rnImports import_decls ; updGblEnv ( \ gbl -> gbl { tcg_rdr_env = rdr_env, - tcg_imports = imports }) + tcg_imports = tcg_imports gbl `plusImportAvails` imports }) $ do { traceRn (text "rn1") ; -- Fail if there are any errors so far @@ -172,7 +172,7 @@ tcRnModule hsc_env pcs updGblEnv (\gbl -> gbl { tcg_deprecs = tcg_deprecs gbl `plusDeprecs` mod_deprecs }) $ do { - traceRn (text "rn4") ; + traceRn (text "Rn4:" <+> ppr (imp_unqual (tcg_imports tcg_env))) ; -- Process the export list export_avails <- exportsFromAvail exports ; updGblEnv (\gbl -> gbl { tcg_exports = export_avails }) diff --git a/ghc/compiler/typecheck/TcRnMonad.lhs b/ghc/compiler/typecheck/TcRnMonad.lhs index 58930ac..07dbe12 100644 --- a/ghc/compiler/typecheck/TcRnMonad.lhs +++ b/ghc/compiler/typecheck/TcRnMonad.lhs @@ -14,7 +14,7 @@ import HscTypes ( HscEnv(..), PersistentCompilerState(..), GlobalRdrEnv, LocalRdrEnv, NameCache, FixityEnv, GhciMode, lookupType, unQualInScope ) import TcRnTypes -import Module ( Module, foldModuleEnv ) +import Module ( Module, moduleName, foldModuleEnv ) import Name ( Name, isInternalName ) import Type ( Type ) import NameEnv ( extendNameEnvList ) @@ -140,7 +140,7 @@ initTc (HscEnv { hsc_mode = ghci_mode, tcg_ist = mkImpTypeEnv eps hpt, tcg_inst_env = mkImpInstEnv dflags eps hpt, tcg_exports = [], - tcg_imports = emptyImportAvails, + tcg_imports = init_imports, tcg_binds = EmptyMonoBinds, tcg_deprecs = NoDeprecs, tcg_insts = [], @@ -177,6 +177,13 @@ initTc (HscEnv { hsc_mode = ghci_mode, where eps = pcs_EPS pcs + init_imports = mkImportAvails (moduleName mod) True [] + -- Initialise tcg_imports with an empty set of bindings for + -- this module, so that if we see 'module M' in the export + -- list, and there are no bindings in M, we don't bleat + -- "unknown module M". + + defaultDefaultTys :: [Type] defaultDefaultTys = [integerTy, doubleTy]