diff options
Diffstat (limited to 'compiler/GHC/Tc')
| -rw-r--r-- | compiler/GHC/Tc/Module.hs | 4 | ||||
| -rw-r--r-- | compiler/GHC/Tc/Types.hs | 27 | ||||
| -rw-r--r-- | compiler/GHC/Tc/Utils/Backpack.hs | 8 | ||||
| -rw-r--r-- | compiler/GHC/Tc/Utils/Monad.hs | 6 |
4 files changed, 23 insertions, 22 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs index 94402c0989..267a36cd89 100644 --- a/compiler/GHC/Tc/Module.hs +++ b/compiler/GHC/Tc/Module.hs @@ -321,7 +321,7 @@ tcRnImports hsc_env import_decls = do { (rn_imports, rdr_env, imports, hpc_info) <- rnImports import_decls ; ; this_mod <- getModule - ; let { dep_mods :: ModuleNameEnv (ModuleName, IsBootInterface) + ; let { dep_mods :: ModuleNameEnv ModuleNameWithIsBoot ; dep_mods = imp_dep_mods imports -- We want instance declarations from all home-package @@ -1973,7 +1973,7 @@ runTcInteractive hsc_env thing_inside ; let getOrphans m mb_pkg = fmap (\iface -> mi_module iface : dep_orphs (mi_deps iface)) (loadSrcInterface (text "runTcInteractive") m - False mb_pkg) + NotBoot mb_pkg) ; !orphs <- fmap (force . concat) . forM (ic_imports icxt) $ \i -> case i of -- force above: see #15111 diff --git a/compiler/GHC/Tc/Types.hs b/compiler/GHC/Tc/Types.hs index 6e60efd4d5..4da234ea08 100644 --- a/compiler/GHC/Tc/Types.hs +++ b/compiler/GHC/Tc/Types.hs @@ -262,7 +262,7 @@ data IfLclEnv -- Whether or not the IfaceDecl came from a boot -- file or not; we'll use this to choose between -- NoUnfolding and BootUnfolding - if_boot :: Bool, + if_boot :: IsBootInterface, -- The field is used only for error reporting -- if (say) there's a Lint error in it @@ -1340,7 +1340,7 @@ data ImportAvails -- different packages. (currently not the case, but might be in the -- future). - imp_dep_mods :: ModuleNameEnv (ModuleName, IsBootInterface), + imp_dep_mods :: ModuleNameEnv ModuleNameWithIsBoot, -- ^ Home-package modules needed by the module being compiled -- -- It doesn't matter whether any of these dependencies @@ -1381,15 +1381,15 @@ data ImportAvails -- including us for imported modules) } -mkModDeps :: [(ModuleName, IsBootInterface)] - -> ModuleNameEnv (ModuleName, IsBootInterface) +mkModDeps :: [ModuleNameWithIsBoot] + -> ModuleNameEnv ModuleNameWithIsBoot mkModDeps deps = foldl' add emptyUFM deps - where - add env elt@(m,_) = addToUFM env m elt + where + add env elt = addToUFM env (gwib_mod elt) elt modDepsElts - :: ModuleNameEnv (ModuleName, IsBootInterface) - -> [(ModuleName, IsBootInterface)] + :: ModuleNameEnv ModuleNameWithIsBoot + -> [ModuleNameWithIsBoot] modDepsElts = sort . nonDetEltsUFM -- It's OK to use nonDetEltsUFM here because sorting by module names -- restores determinism @@ -1426,9 +1426,10 @@ plusImportAvails imp_orphs = orphs1 `unionLists` orphs2, imp_finsts = finsts1 `unionLists` finsts2 } where - plus_mod_dep r1@(m1, boot1) r2@(m2, boot2) - | ASSERT2( m1 == m2, (ppr m1 <+> ppr m2) $$ (ppr boot1 <+> ppr boot2) ) - boot1 = r2 + plus_mod_dep r1@(GWIB { gwib_mod = m1, gwib_isBoot = boot1 }) + r2@(GWIB {gwib_mod = m2, gwib_isBoot = boot2}) + | ASSERT2( m1 == m2, (ppr m1 <+> ppr m2) $$ (ppr (boot1 == IsBoot) <+> ppr (boot2 == IsBoot))) + boot1 == IsBoot = r2 | otherwise = r1 -- If either side can "see" a non-hi-boot interface, use that -- Reusing existing tuples saves 10% of allocations on test @@ -1451,8 +1452,8 @@ data WhereFrom -- See Note [Care with plugin imports] in GHC.Iface.Load instance Outputable WhereFrom where - ppr (ImportByUser is_boot) | is_boot = text "{- SOURCE -}" - | otherwise = empty + ppr (ImportByUser IsBoot) = text "{- SOURCE -}" + ppr (ImportByUser NotBoot) = empty ppr ImportBySystem = text "{- SYSTEM -}" ppr ImportByPlugin = text "{- PLUGIN -}" diff --git a/compiler/GHC/Tc/Utils/Backpack.hs b/compiler/GHC/Tc/Utils/Backpack.hs index d28dad8f70..98458b884b 100644 --- a/compiler/GHC/Tc/Utils/Backpack.hs +++ b/compiler/GHC/Tc/Utils/Backpack.hs @@ -549,7 +549,7 @@ mergeSignatures im = fst (getModuleInstantiation m) in fmap fst . withException - $ findAndReadIface (text "mergeSignatures") im m False + $ findAndReadIface (text "mergeSignatures") im m NotBoot -- STEP 3: Get the unrenamed exports of all these interfaces, -- thin it according to the export list, and do shaping on them. @@ -842,7 +842,7 @@ mergeSignatures -- supposed to include itself in its dep_orphs/dep_finsts. See #13214 iface' = iface { mi_final_exts = (mi_final_exts iface){ mi_orphan = False, mi_finsts = False } } avails = plusImportAvails (tcg_imports tcg_env) $ - calculateAvails dflags iface' False False ImportedBySystem + calculateAvails dflags iface' False NotBoot ImportedBySystem return tcg_env { tcg_inst_env = inst_env, tcg_insts = insts, @@ -929,7 +929,7 @@ checkImplements impl_mod req_mod@(Module uid mod_name) = dflags <- getDynFlags let avails = calculateAvails dflags - impl_iface False{- safe -} False{- boot -} ImportedBySystem + impl_iface False{- safe -} NotBoot ImportedBySystem fix_env = mkNameEnv [ (gre_name rdr_elt, FixItem occ f) | (occ, f) <- mi_fixities impl_iface , rdr_elt <- lookupGlobalRdrEnv impl_gr occ ] @@ -953,7 +953,7 @@ checkImplements impl_mod req_mod@(Module uid mod_name) = -- instantiation is correct. let sig_mod = mkModule (VirtUnit uid) mod_name isig_mod = fst (getModuleInstantiation sig_mod) - mb_isig_iface <- findAndReadIface (text "checkImplements 2") isig_mod sig_mod False + mb_isig_iface <- findAndReadIface (text "checkImplements 2") isig_mod sig_mod NotBoot isig_iface <- case mb_isig_iface of Succeeded (iface, _) -> return iface Failed err -> failWithTc $ diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs index 85b3ad2e96..2fc741ce6f 100644 --- a/compiler/GHC/Tc/Utils/Monad.hs +++ b/compiler/GHC/Tc/Utils/Monad.hs @@ -1830,7 +1830,7 @@ setLocalRdrEnv rdr_env thing_inside ************************************************************************ -} -mkIfLclEnv :: Module -> SDoc -> Bool -> IfLclEnv +mkIfLclEnv :: Module -> SDoc -> IsBootInterface -> IfLclEnv mkIfLclEnv mod loc boot = IfLclEnv { if_mod = mod, if_loc = loc, @@ -1887,14 +1887,14 @@ initIfaceCheck doc hsc_env do_this } initTcRnIf 'i' hsc_env gbl_env () do_this -initIfaceLcl :: Module -> SDoc -> Bool -> IfL a -> IfM lcl a +initIfaceLcl :: Module -> SDoc -> IsBootInterface -> IfL a -> IfM lcl a initIfaceLcl mod loc_doc hi_boot_file thing_inside = setLclEnv (mkIfLclEnv mod loc_doc hi_boot_file) thing_inside -- | Initialize interface typechecking, but with a 'NameShape' -- to apply when typechecking top-level 'OccName's (see -- 'lookupIfaceTop') -initIfaceLclWithSubst :: Module -> SDoc -> Bool -> NameShape -> IfL a -> IfM lcl a +initIfaceLclWithSubst :: Module -> SDoc -> IsBootInterface -> NameShape -> IfL a -> IfM lcl a initIfaceLclWithSubst mod loc_doc hi_boot_file nsubst thing_inside = setLclEnv ((mkIfLclEnv mod loc_doc hi_boot_file) { if_nsubst = Just nsubst }) thing_inside |
