[Git][ghc/ghc][wip/spj-reinstallable-base2] Make GHC.Essentials a hidden module
sheaf pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC Commits: e986375e by sheaf at 2026-07-27T16:32:29+02:00 Make GHC.Essentials a hidden module - - - - - 12 changed files: - compiler/GHC/Builtin.hs - compiler/GHC/Driver/Downsweep.hs - compiler/GHC/Iface/Errors/Ppr.hs - compiler/GHC/Iface/Load.hs - compiler/GHC/Parser/Header.hs - compiler/GHC/Unit/Finder.hs - compiler/GHC/Unit/State.hs - libraries/base/base.cabal.in - testsuite/tests/interface-stability/base-exports.stdout - testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs - testsuite/tests/interface-stability/base-exports.stdout-mingw32 - utils/dump-decls/Main.hs Changes: ===================================== compiler/GHC/Builtin.hs ===================================== @@ -225,8 +225,7 @@ How known-occ entities work This is a big reason for (KnownOccNameInvariant): an export list cannot have two entities with the same OccName. - When GHC wants to find GHC.Essentials, it just looks for it in the same - way as any other import. + See Note [Finding GHC.Essentials] for how GHC finds the GHC.Essentials module. * There are three flags that control the treatment of known entities: -frebindable-known-names @@ -412,10 +411,9 @@ To make `wombat` into a known-key name, do the following. * Just like for known-occ names above, in any module in `base` or `ghc-internal` (which are compiled with -frebindable-known-names), ensure that `wombat` is in scope by saying `import M( wombat )`. --} -{- Note [Known entities and reinstallable base] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [Known entities and reinstallable base] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The design of known-entities in GHC, described in Note [Overview of known entities], is carefully crafted to support a single version of GHC to compile different versions of base, even though GHC itself is compiled against a fixed version of @@ -453,6 +451,23 @@ Let's compare two examples: `coerce` and `enumFromTo`. `enumFromTo` (see `GHC.Iface.Load.lookupKnownOccName`). This means GHC never needs to know where precisely `enumFromTo` is defined, allowing it to be defined anywhere (wherever in `base`, or in a module imported by `base`). + +Note [Finding GHC.Essentials] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +As GHC.Essentials is an implementation detail for GHC, we would really rather +not expose this module from base. + +Achieving this requires a little bit of care: + + (FindEssentials1) + When looking up GHC.Essentials in GHC.Iface.Load.findEssentialsModule, + allow the module to be hidden (as long as the unit isn't hidden) by calling + 'findImportedModuleAllowHidden'. + + (FindEssentials2) + To ensure the implicit module graph edge added in GHC.Parser.Header.getImportEdges + is properly resolved during downsweep, we use 'findImportedModuleAllowHidden' + in GHC.Driver.Downsweep. -} {- ===================================== compiler/GHC/Driver/Downsweep.hs ===================================== @@ -78,7 +78,7 @@ import GHC.Types.Unique.Map import GHC.Types.PkgQual import GHC.Types.Basic - +import GHC.Builtin.Modules( eSSENTIALS_NAME ) import GHC.Unit import GHC.Unit.Env import GHC.Unit.Finder @@ -1373,10 +1373,20 @@ summariseModuleDispatch k hsc_env' home_unit is_boot (L _ wanted_mod) mb_pkg exc -- happen relative to it hsc_env = hscSetActiveHomeUnit home_unit hsc_env' - find_it :: IO SummariseResult + find_module :: IO FindResult + find_module + | wanted_mod == eSSENTIALS_NAME + -- The implicit edge to GHC.Essentials added by 'getImportEdges' must be + -- resolved even when GHC.Essential is a hidden module. + -- + -- See (FindEssentials2) in Note [Finding GHC.Essentials] in GHC.Builtin. + = findImportedModuleAllowHidden hsc_env wanted_mod mb_pkg + | otherwise + = findImportedModuleWithIsBoot hsc_env wanted_mod is_boot mb_pkg + find_it :: IO SummariseResult find_it = do - found <- findImportedModuleWithIsBoot hsc_env wanted_mod is_boot mb_pkg + found <- find_module case found of Found location mod | moduleUnitId mod `Set.member` hsc_all_home_unit_ids hsc_env -> ===================================== compiler/GHC/Iface/Errors/Ppr.hs ===================================== @@ -210,7 +210,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst -- package flags when making suggestions. ToDo: if the original package -- also has a reexport, prefer that one pp_sugg (SuggestVisible m mod o) = ppr m <+> provenance o - where provenance ModHidden = empty + where provenance (ModHidden {}) = empty provenance (ModUnusable _) = empty provenance (ModOrigin{ fromOrigUnit = e, fromExposedReexport = res, @@ -227,7 +227,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst <+> ppr mod) | otherwise = empty pp_sugg (SuggestHidden m mod o) = ppr m <+> provenance o - where provenance ModHidden = empty + where provenance (ModHidden {}) = empty provenance (ModUnusable _) = empty provenance (ModOrigin{ fromOrigUnit = e, fromHiddenReexport = rhs }) @@ -261,7 +261,7 @@ cantFindErrorX pkg_hidden_hint may_show_locations mod_or_interface (CantFindInst where pprMod (m, o) = text "it is bound as" <+> ppr m <+> text "by" <+> pprOrigin m o - pprOrigin _ ModHidden = panic "cantFindErr: bound by mod hidden" + pprOrigin _ (ModHidden {}) = panic "cantFindErr: bound by mod hidden" pprOrigin _ (ModUnusable _) = panic "cantFindErr: bound by mod unusable" pprOrigin m (ModOrigin e res _ f) = sep $ punctuate comma ( if e == Just True ===================================== compiler/GHC/Iface/Load.hs ===================================== @@ -302,13 +302,14 @@ loadKnownKeyOccMaps -- We don't have a KnownKeyOccMap yet, so create it -- from the interface file for KnownKeyName do { hsc_env <- getTopEnv - ; mb_res <- liftIO $ findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual - ; case mb_res of - Found _ mod -> Succeeded <$> build_maps mod - fr -> return (Failed (CantFindEssentials - (cannotFindModule hsc_env eSSENTIALS_NAME fr) - UnknownLoadEssentialsReason)) - } } } + ; res <- liftIO $ findEssentialsModule hsc_env + ; case res of + Succeeded mod -> Succeeded <$> build_maps mod + Failed err -> + return $ Failed $ + CantFindEssentials err UnknownLoadEssentialsReason + }}} + where doc = text "Need interface for KnownKeyNames" @@ -374,21 +375,33 @@ checkKnownKeyNamesIface known_key_names_occ_map -- | Lookup the module exporting the canonical known-entities definitions (GHC.Essentials) lookupKnownKeysModule :: HscEnv -> DynFlags {-^ Module dyn flags -} -> IO (Maybe Module) -lookupKnownKeysModule hsc_env dflags = do - eps <- hscEPS hsc_env - case eps_known_keys eps of - Just (_, kk_mod) -> return (Just kk_mod) - Nothing -> do - found_essentials <- findImportedModule hsc_env eSSENTIALS_NAME NoPkgQual - let rebindable_kn = gopt Opt_RebindableKnownNames dflags - let essentials_uid - | rebindable_kn = return Nothing - | Found _ mod <- found_essentials = return (Just mod) - | fr <- found_essentials = do - throwOneError (initSourceErrorContext dflags) $ - mkPlainErrorMsgEnvelope noSrcSpan $ GhcDriverMessage $ DriverInterfaceError $ - CantFindEssentials (cannotFindModule hsc_env eSSENTIALS_NAME fr) LookingForEssentialsModule - essentials_uid +lookupKnownKeysModule hsc_env dflags + | gopt Opt_RebindableKnownNames dflags + = return Nothing + | otherwise + = do { eps <- hscEPS hsc_env + ; case eps_known_keys eps of + { Just (_, kk_mod) -> return (Just kk_mod) + ; Nothing -> + do { mb_mod <- findEssentialsModule hsc_env + ; case mb_mod of + { Succeeded mod -> return (Just mod) + ; Failed err -> + throwOneError (initSourceErrorContext dflags) $ + mkPlainErrorMsgEnvelope noSrcSpan $ + GhcDriverMessage $ DriverInterfaceError $ + CantFindEssentials err LookingForEssentialsModule + }}}} + +-- | Find the GHC.Essentials module. +-- +-- See Note [Finding GHC.Essentials] in GHC.Builtin. +findEssentialsModule :: HscEnv -> IO (MaybeErr MissingInterfaceError Module) +findEssentialsModule hsc_env = do + fr <- findImportedModuleAllowHidden hsc_env eSSENTIALS_NAME NoPkgQual + return $ case fr of + Found _ mod -> Succeeded mod + _ -> Failed $ cannotFindModule hsc_env eSSENTIALS_NAME fr {- ********************************************************************* * * ===================================== compiler/GHC/Parser/Header.hs ===================================== @@ -114,7 +114,8 @@ getImportEdges dflags buf filename source_filename = do convImport (L _ (i :: ImportDecl GhcPs)) = (convImportLevel (ideclLevelSpec i), ideclPkgQual i, reLoc $ ideclName i) convImport_src (L _ (i :: ImportDecl GhcPs)) = (reLoc $ ideclName i) - known_key_name_edges -- Add an edge to GHC.Essentials, unless -frebindable-known-names is on + -- Add an edge to GHC.Essentials, unless -frebindable-known-names is on + known_key_name_edges | rebindable_kn = [] | otherwise = [(NormalLevel, NoRawPkgQual, noLoc eSSENTIALS_NAME)] in ===================================== compiler/GHC/Unit/Finder.hs ===================================== @@ -14,6 +14,7 @@ module GHC.Unit.Finder ( FinderCache(..), initFinderCache, findImportedModule, + findImportedModuleAllowHidden, findImportedModuleWithIsBoot, findPluginModule, findExactModule, @@ -172,24 +173,42 @@ getDirHash dir = do return hash -- ----------------------------------------------------------------------------- --- The three external entry points - +-- External entry points + +-- | Should a module which is not in its unit's @exposed-modules@ still be +-- found, provided the unit itself is visible? +data HiddenModulePolicy + -- | Normal behaviour (e.g. user-written imports): don't find hidden modules. + = RejectHiddenModules + -- | Allow hidden modules (from non-hidden units) to be found. + -- + -- See Note [Finding GHC.Essentials] in GHC.Builtin. + | AcceptHiddenModules -- | Locate a module that was imported by the user. We have the -- module's name, and possibly a package name. Without a package -- name, this function will use the search path and the known exposed -- packages to find the module, if a package is specified then only -- that package is searched for the module. - findImportedModule :: HscEnv -> ModuleName -> PkgQual -> IO FindResult -findImportedModule hsc_env mod pkg_qual = +findImportedModule = findImportedModule_policy RejectHiddenModules + +-- | Like 'findImportedModule', but also finds hidden modules (from non-hidden units). +-- +-- See (FindEssentials1) in Note [Finding GHC.Essentials] in GHC.Builtin. +findImportedModuleAllowHidden :: HscEnv -> ModuleName -> PkgQual -> IO FindResult +findImportedModuleAllowHidden = findImportedModule_policy AcceptHiddenModules + +-- | Internal helper for 'findImportedModule' and 'findImportedModuleAllowHidden'. +findImportedModule_policy :: HiddenModulePolicy -> HscEnv -> ModuleName -> PkgQual -> IO FindResult +findImportedModule_policy policy hsc_env mod pkg_qual = let fc = hsc_FC hsc_env mb_home_unit = hsc_home_unit_maybe hsc_env dflags = hsc_dflags hsc_env fopts = initFinderOpts dflags in do let home_module_name_providers_map = mgHomeModuleNameProvidersMap (hsc_mod_graph hsc_env) - findImportedModuleNoHsc fc fopts (hsc_unit_env hsc_env) home_module_name_providers_map mb_home_unit mod pkg_qual + findImportedModuleNoHsc policy fc fopts (hsc_unit_env hsc_env) home_module_name_providers_map mb_home_unit mod pkg_qual findImportedModuleWithIsBoot :: HscEnv -> ModuleName -> IsBootInterface -> PkgQual -> IO FindResult findImportedModuleWithIsBoot hsc_env mod is_boot pkg_qual = do @@ -199,7 +218,8 @@ findImportedModuleWithIsBoot hsc_env mod is_boot pkg_qual = do _ -> return res findImportedModuleNoHsc - :: FinderCache + :: HiddenModulePolicy + -> FinderCache -> FinderOpts -> UnitEnv -> HomeModuleNameProvidersMap @@ -207,7 +227,7 @@ findImportedModuleNoHsc -> ModuleName -> PkgQual -> IO FindResult -findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit mod_name mb_pkg = +findImportedModuleNoHsc policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name mb_pkg = case mb_pkg of NoPkgQual -> unqual_import ThisPkg uid | (homeUnitId <$> mb_home_unit) == Just uid -> home_import @@ -231,13 +251,13 @@ findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit NoPackage (panic "findImportedModule: no home-unit") home_pkg_import :: (UnitId, FinderOpts) -> IO FindResult - home_pkg_import = findHomeUnitDepModule fc ue home_module_name_providers_map mod_name + home_pkg_import = findHomeUnitDepModule policy fc ue home_module_name_providers_map mod_name pkg_import :: IO FindResult - pkg_import = findExposedPackageModule fc fopts unit_state mod_name mb_pkg + pkg_import = findExposedPackageModule_policy policy fc fopts unit_state mod_name mb_pkg unqual_import :: IO FindResult - unqual_import = findHomeOrRegularPackageModule fc fopts ue + unqual_import = findHomeOrRegularPackageModule policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name unit_state :: UnitState @@ -263,7 +283,7 @@ findPluginModuleNoHsc -> ModuleName -> IO FindResult findPluginModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit@(Just home_unit) mod_name = - findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map + findHomeModuleAmongDeps RejectHiddenModules fc fopts ue home_module_name_providers_map mb_home_unit mod_name `orIfNotFound` findExposedPluginPackageModule fc fopts unit_state mod_name @@ -339,21 +359,23 @@ homeUnitDepsFinderOpts ue home_module_name_providers_map unit_state mod_name = -- | Search for @mod_name@ in the given home unit. findHomeUnitDepModule - :: FinderCache + :: HiddenModulePolicy + -> FinderCache -> UnitEnv -> HomeModuleNameProvidersMap -> ModuleName -> (UnitId, FinderOpts) -> IO FindResult -findHomeUnitDepModule fc ue home_module_name_providers_map mod_name (uid, opts) +findHomeUnitDepModule policy fc ue home_module_name_providers_map mod_name (uid, opts) -- If the module is reexported, then look for it as if it was from the -- perspective of the package which reexports it. | Just real_mod_name <- lookupUniqMap (finder_reexportedModules opts) mod_name - = findHomeOrRegularPackageModule fc opts ue home_module_name_providers_map + = findHomeOrRegularPackageModule policy fc opts ue home_module_name_providers_map (Just $ DefiniteHomeUnit uid Nothing) real_mod_name - | elementOfUniqSet mod_name (finder_hiddenModules opts) + | RejectHiddenModules <- policy + , elementOfUniqSet mod_name (finder_hiddenModules opts) = return (mkHomeHidden uid) | otherwise = findHomePackageModule fc opts uid mod_name @@ -363,14 +385,15 @@ findHomeUnitDepModule fc ue home_module_name_providers_map mod_name (uid, opts) -- reexports along the way (see 'findHomeUnitDepModule'). Yields the first -- successful result. findHomeModuleAmongDeps - :: FinderCache + :: HiddenModulePolicy + -> FinderCache -> FinderOpts -> UnitEnv -> HomeModuleNameProvidersMap -> Maybe HomeUnit -> ModuleName -> IO FindResult -findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map mb_home_unit mod_name = +findHomeModuleAmongDeps policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name = foldr1 orIfNotFound (home_import :| map home_pkg_import other_fopts) -- Do not try to be smart and change this to `foldr orIfNotFound home_import -- (map home_pkg_import other_fopts)`, as that would not be the same. @@ -381,7 +404,7 @@ findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map mb_home_unit Just home_unit -> findHomeModule fc fopts home_unit mod_name Nothing -> pure $ NoPackage (panic "findHomeModuleAmongDeps: no home-unit") - home_pkg_import = findHomeUnitDepModule fc ue home_module_name_providers_map mod_name + home_pkg_import = findHomeUnitDepModule policy fc ue home_module_name_providers_map mod_name unit_state = case homeUnitId <$> mb_home_unit of Nothing -> ue_homeUnitState ue @@ -393,18 +416,19 @@ findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map mb_home_unit -- | Search the home-unit graph and otherwise the regular exposed package -- database. findHomeOrRegularPackageModule - :: FinderCache + :: HiddenModulePolicy + -> FinderCache -> FinderOpts -> UnitEnv -> HomeModuleNameProvidersMap -> Maybe HomeUnit -> ModuleName -> IO FindResult -findHomeOrRegularPackageModule fc fopts ue home_module_name_providers_map mb_home_unit mod_name = - findHomeModuleAmongDeps fc fopts ue home_module_name_providers_map +findHomeOrRegularPackageModule policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name = + findHomeModuleAmongDeps policy fc fopts ue home_module_name_providers_map mb_home_unit mod_name `orIfNotFound` - findExposedPackageModule fc fopts unit_state mod_name NoPkgQual + findExposedPackageModule_policy policy fc fopts unit_state mod_name NoPkgQual where unit_state = case homeUnitId <$> mb_home_unit of Nothing -> ue_homeUnitState ue @@ -482,36 +506,29 @@ homeSearchCache fc home_unit mod_name do_this = do modLocationCache fc mod do_this findExposedPackageModule :: FinderCache -> FinderOpts -> UnitState -> ModuleName -> PkgQual -> IO FindResult -findExposedPackageModule fc fopts units mod_name mb_pkg = - findLookupResult fc fopts +findExposedPackageModule = findExposedPackageModule_policy RejectHiddenModules + +findExposedPackageModule_policy :: HiddenModulePolicy -> FinderCache -> FinderOpts -> UnitState -> ModuleName -> PkgQual -> IO FindResult +findExposedPackageModule_policy policy fc fopts units mod_name mb_pkg = + findLookupResult policy fc fopts units $ lookupModuleWithSuggestions units mod_name mb_pkg findExposedPluginPackageModule :: FinderCache -> FinderOpts -> UnitState -> ModuleName -> IO FindResult findExposedPluginPackageModule fc fopts units mod_name = - findLookupResult fc fopts + findLookupResult RejectHiddenModules fc fopts units $ lookupPluginModuleWithSuggestions units mod_name NoPkgQual -findLookupResult :: FinderCache -> FinderOpts -> LookupResult -> IO FindResult -findLookupResult fc fopts r = case r of - LookupFound m pkg_conf -> do - let im = fst (getModuleInstantiation m) - r' <- findPackageModule_ fc fopts im (fst pkg_conf) - case r' of - -- TODO: ghc -M is unlikely to do the right thing - -- with just the location of the thing that was - -- instantiated; you probably also need all of the - -- implicit locations from the instances - InstalledFound loc -> return (Found loc m) - InstalledNoPackage _ -> return (NoPackage (moduleUnit m)) - InstalledNotFound fp _ -> return (NotFound{ fr_paths = fmap unsafeDecodeUtf fp, fr_pkg = Just (moduleUnit m) - , fr_pkgs_hidden = [] - , fr_mods_hidden = [] - , fr_unusables = [] - , fr_suggestions = []}) +findLookupResult :: HiddenModulePolicy -> FinderCache -> FinderOpts -> UnitState -> LookupResult -> IO FindResult +findLookupResult policy fc fopts units r = case r of + LookupFound m pkg_conf -> found_module m (findPackageModule_ fc fopts (instantiated m) (fst pkg_conf)) LookupMultiple rs -> return (FoundMultiple rs) - LookupHidden fr_pkgs_hidden mod_hiddens -> - return (NotFound{ fr_paths = [], fr_pkg = Nothing + LookupHidden fr_pkgs_hidden mod_hiddens + | AcceptHiddenModules <- policy + , [m] <- [ m | (m, ModHidden HiddenModInVisibleUnit) <- mod_hiddens ] + -> found_module m (findPackageModule fc units fopts (instantiated m)) + | otherwise + -> return (NotFound{ fr_paths = [], fr_pkg = Nothing , fr_pkgs_hidden , fr_mods_hidden = map (moduleUnit.fst) mod_hiddens , fr_unusables = [] @@ -535,6 +552,29 @@ findLookupResult fc fopts r = case r of , fr_mods_hidden = [] , fr_unusables = [] , fr_suggestions = suggest' }) + where + instantiated m = fst (getModuleInstantiation m) + + -- TODO: ghc -M is unlikely to do the right thing + -- with just the location of the thing that was + -- instantiated; you probably also need all of the + -- implicit locations from the instances + found_module :: Module -> IO InstalledFindResult -> IO FindResult + found_module m find = do + r' <- find + return $ + case r' of + InstalledFound loc -> Found loc m + InstalledNoPackage {} -> NoPackage (moduleUnit m) + InstalledNotFound fp _ -> + NotFound + { fr_paths = fmap unsafeDecodeUtf fp + , fr_pkg = Just (moduleUnit m) + , fr_pkgs_hidden = [] + , fr_mods_hidden = [] + , fr_unusables = [] + , fr_suggestions = [] + } modLocationCache :: FinderCache -> InstalledModule -> IO InstalledFindResult -> IO InstalledFindResult modLocationCache fc mod do_this = do ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -38,6 +38,7 @@ module GHC.Unit.State ( LookupResult(..), ModuleSuggestion(..), ModuleOrigin(..), + HiddenModuleUnit(..), UnusableUnit(..), UnusableUnitReason(..), pprReason, @@ -168,10 +169,8 @@ import Control.Applicative -- it could have come into scope. Warning: don't use the record functions, -- they're partial! data ModuleOrigin = - -- | Module is hidden, and thus never will be available for import. - -- (But maybe the user didn't realize), so we'll still keep track - -- of these modules.) - ModHidden + -- | The module is hidden (thus not available for a user-written import). + ModHidden !HiddenModuleUnit -- | Module is unavailable because the unit is unusable. | ModUnusable !UnusableUnit @@ -193,6 +192,11 @@ data ModuleOrigin = , fromPackageFlag :: Bool } +-- | Is the unit providing a hidden module itself visible in this compilation? +data HiddenModuleUnit + = HiddenModInVisibleUnit + | HiddenModInHiddenUnit + -- | A unusable unit module origin data UnusableUnit = UnusableUnit { uuUnit :: !Unit -- ^ Unusable unit @@ -201,7 +205,7 @@ data UnusableUnit = UnusableUnit } instance Outputable ModuleOrigin where - ppr ModHidden = text "hidden module" + ppr (ModHidden {}) = text "hidden module" ppr (ModUnusable _) = text "unusable module" ppr (ModOrigin e res rhs f) = sep (punctuate comma ( (case e of @@ -255,7 +259,7 @@ instance Monoid ModuleOrigin where -- | Is the name from the import actually visible? (i.e. does it cause -- ambiguity, or is it only relevant when we're making suggestions?) originVisible :: ModuleOrigin -> Bool -originVisible ModHidden = False +originVisible (ModHidden {}) = False originVisible (ModUnusable _) = False originVisible (ModOrigin b res _ f) = b == Just True || not (null res) || f @@ -1819,7 +1823,11 @@ mkModuleNameProvidersMap logger cfg pkg_map vis_map = esmap = listToUFM (es False) -- parameter here doesn't matter, orig will -- be overwritten - hiddens = [(m, mkModMap pk m ModHidden) | m <- hidden_mods] + hiddens = [(m, mkModMap pk m (ModHidden hidden_mod_unit)) | m <- hidden_mods] + + hidden_mod_unit + | b || not (null rns) = HiddenModInVisibleUnit + | otherwise = HiddenModInHiddenUnit pk = mkUnit pkg unit_lookup uid = lookupUnit' (unitConfigAllowVirtual cfg) pkg_map uid @@ -1970,7 +1978,7 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn let origin = filterOrigin mb_pn (mod_unit m) origin0 x = (m, origin) in case origin of - ModHidden + ModHidden {} -> (hidden_pkg, x:hidden_mod, unusable, exposed) ModUnusable _ -> (hidden_pkg, hidden_mod, x:unusable, exposed) @@ -2003,8 +2011,8 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn filterOrigin (OtherPkg u) pkg o = let match_pkg p = u == unitId p in case o of - ModHidden - | match_pkg pkg -> ModHidden + ModHidden {} + | match_pkg pkg -> o | otherwise -> mempty ModUnusable _ | match_pkg pkg -> o ===================================== libraries/base/base.cabal.in ===================================== @@ -219,7 +219,6 @@ Library , GHC.Integer.Logarithms , GHC.IsList , GHC.Ix - , GHC.Essentials , GHC.List , GHC.Maybe , GHC.MVar @@ -307,6 +306,7 @@ Library other-modules: Data.List.NubOrdSet + GHC.Essentials System.CPUTime.Unsupported System.CPUTime.Utils if os(windows) ===================================== testsuite/tests/interface-stability/base-exports.stdout ===================================== @@ -5295,10 +5295,6 @@ module GHC.Err where errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a -module GHC.Essentials where - --- ignored - module GHC.Event where -- Safety: Safe ===================================== testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs ===================================== @@ -5295,10 +5295,6 @@ module GHC.Err where errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a -module GHC.Essentials where - --- ignored - module GHC.Event where -- Safety: Safe ===================================== testsuite/tests/interface-stability/base-exports.stdout-mingw32 ===================================== @@ -5340,10 +5340,6 @@ module GHC.Err where errorWithoutStackTrace :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). [GHC.Internal.Types.Char] -> a undefined :: forall (r :: GHC.Internal.Types.RuntimeRep) (a :: TYPE r). GHC.Internal.Stack.Types.HasCallStack => a -module GHC.Essentials where - --- ignored - module GHC.Event.TimeOut where -- Safety: None ===================================== utils/dump-decls/Main.hs ===================================== @@ -68,7 +68,6 @@ ignoredModules = map mkModuleName $ concat [ unstableModules , platformDependentModules - , internalModules ] where unstableModules = @@ -81,8 +80,6 @@ ignoredModules = , "GHC.Num.Backend" , "GHC.Num.Backend.Selected" ] - internalModules = - [ "GHC.Essentials" ] ignoredOccNames :: [OccName] ignoredOccNames = View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e986375ea75e354e0667459050bcdf8c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e986375ea75e354e0667459050bcdf8c... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
sheaf (@sheaf)