sheaf pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC Commits: f680e170 by sheaf at 2026-08-06T17:55:07+02:00 Allow GHC.Essentials to be hidden This commit overhauls several aspects of the known entity handling, in order to allow GHC.Essentials to be hidden without a proliferation of special cases in the compiler. The main contribution is to introduce the 'UnresolvedImport' datatype which cleans up a lot of ad-hoc handling relating to 'ModSummary', fixing #27603. This allows us to reduce duplication, e.g. by having Backpack reuse 'mkUnresolvedImports' instead of replicating the "add implicit imports" logic. It also makes it easier to avoid undesirable edge cases (such as making sure that the Template Haskell 'reifyModule' function does not leak the implicit GHC.Essentials import). In particular, the infamous 'findImportedModuleWithIsBoot' is now simply 'resolveImport', taking a single 'UnresolvedImport' and resolving it to a 'FindResult' (usually a 'Module'). Other changes: - Cache the result of looking up GHC.Essentials (in TcM and DsM environments) to avoid redundant work. This reduces allocations on LinkableUsage01 and hard_hole_fits. - Properly look up known entities for StaticPointers like we do for other known entities everywhere else. This allows e.g. modules in ghc-internal to use -XStaticPointers. - When using multiple home units, we are now careful to handle the situation in which we may have multiple GHC.Essentials modules around. See the new tests under 'driver/multipleHomeUnits'. - - - - - 91 changed files: - compiler/GHC.hs - compiler/GHC/Builtin.hs - compiler/GHC/Builtin/Modules.hs - compiler/GHC/Driver/Backpack.hs - compiler/GHC/Driver/Config/Tidy.hs - compiler/GHC/Driver/Downsweep.hs - compiler/GHC/Driver/Main/Passes.hs - compiler/GHC/Driver/Make.hs - compiler/GHC/Driver/MakeFile.hs - compiler/GHC/Driver/Pipeline/Execute.hs - compiler/GHC/Hs/ImpExp.hs - compiler/GHC/HsToCore.hs - compiler/GHC/HsToCore/Monad.hs - compiler/GHC/HsToCore/Types.hs - compiler/GHC/HsToCore/Usage.hs - compiler/GHC/Iface/Errors/Ppr.hs - compiler/GHC/Iface/Errors/Types.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Iface/Load.hs - compiler/GHC/Iface/Make.hs - compiler/GHC/Iface/Recomp.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/IfaceToCore.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Header.hs - compiler/GHC/Rename/Env.hs - compiler/GHC/Rename/Names.hs - compiler/GHC/Runtime/Eval.hs - compiler/GHC/Tc/Gen/Splice.hs - compiler/GHC/Tc/Module.hs - compiler/GHC/Tc/Plugin.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Backpack.hs - compiler/GHC/Tc/Utils/Env.hs - compiler/GHC/Tc/Utils/Monad.hs - + compiler/GHC/Types/UnresolvedImport.hs - compiler/GHC/Unit/External.hs - compiler/GHC/Unit/External/ModuleOrigin.hs - compiler/GHC/Unit/External/Providers.hs - compiler/GHC/Unit/Finder.hs - compiler/GHC/Unit/Finder/Types.hs - compiler/GHC/Unit/Module/Deps.hs - compiler/GHC/Unit/Module/ModSummary.hs - compiler/GHC/Unit/State.hs - compiler/GHC/Unit/Types.hs - compiler/ghc.cabal.in - ghc/GHCi/UI.hs - ghc/Main.hs - libraries/base/base.cabal.in - linters/lint-codes/LintCodes/Static.hs - testsuite/driver/testutil.py - testsuite/tests/cabal/T12485/Makefile - testsuite/tests/driver/T27013e/T27013e.hs - testsuite/tests/driver/T27013e/T27013e.stderr - testsuite/tests/driver/T27013f/T27013f.hs - testsuite/tests/driver/T27013f/T27013f.stderr - + testsuite/tests/driver/T27013g/T27013g.hs - + testsuite/tests/driver/T27013g/all.T - + testsuite/tests/driver/T27013h/GHC/Essentials.hs - + testsuite/tests/driver/T27013h/T27013h.stderr - + testsuite/tests/driver/T27013h/all.T - + testsuite/tests/driver/T27013h/unitT27013h - + testsuite/tests/driver/T27013i/T27013i.hs - + testsuite/tests/driver/T27013i/T27013i.stderr - + testsuite/tests/driver/T27013i/all.T - testsuite/tests/driver/multipleHomeUnits/Makefile - testsuite/tests/driver/multipleHomeUnits/all.T - + testsuite/tests/driver/multipleHomeUnits/essentials-home/GHC/Essentials.hs - + testsuite/tests/driver/multipleHomeUnits/essentials-order-base/B.hs - + testsuite/tests/driver/multipleHomeUnits/essentials-order-user/U.hs - + testsuite/tests/driver/multipleHomeUnits/essentials-user/M.hs - testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stderr - + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_essentials.stdout - + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_essentials_order.stderr - + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_essentials_recomp.stdout - + testsuite/tests/driver/multipleHomeUnits/unitEssentialsHome - + testsuite/tests/driver/multipleHomeUnits/unitEssentialsHomeHidden - + testsuite/tests/driver/multipleHomeUnits/unitEssentialsOrderBase - + testsuite/tests/driver/multipleHomeUnits/unitEssentialsOrderUser - + testsuite/tests/driver/multipleHomeUnits/unitEssentialsUser - + testsuite/tests/driver/multipleHomeUnits/unitEssentialsUserHidden - testsuite/tests/ghc-api/downsweep/PartialDownsweep.hs - testsuite/tests/ghci/scripts/all.T - 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 - testsuite/tests/module/mod185.stderr - testsuite/tests/parser/should_fail/T16270h.hs - + testsuite/tests/th/T27013th.hs - testsuite/tests/th/all.T - utils/haddock/haddock-api/src/Haddock/Interface.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f680e170934897e65697946f19c92e0f... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f680e170934897e65697946f19c92e0f... 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)