summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Backpack.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-07-05 14:16:35 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-21 02:45:39 -0400
commit9eb1641e0ef10a7887e794d4d114c9a18a2fd265 (patch)
tree2974508390083775e3bf2c4efcc2113a4c07a2c3 /compiler/GHC/Driver/Backpack.hs
parentd706fd0432925caf62673a55237a005e22bc4450 (diff)
downloadhaskell-9eb1641e0ef10a7887e794d4d114c9a18a2fd265.tar.gz
driver: Fix recompilation for modules importing GHC.Prim
The GHC.Prim module is quite special as there is no interface file, therefore it doesn't appear in ms_textual_imports, but the ghc-prim package does appear in the direct package dependencies. This confused the recompilation checking which couldn't find any modules from ghc-prim and concluded that the package was no longer a dependency. The fix is to keep track of whether GHC.Prim is imported separately in the relevant places. Fixes #20084
Diffstat (limited to 'compiler/GHC/Driver/Backpack.hs')
-rw-r--r--compiler/GHC/Driver/Backpack.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/GHC/Driver/Backpack.hs b/compiler/GHC/Driver/Backpack.hs
index 2190bdd753..8581865dbf 100644
--- a/compiler/GHC/Driver/Backpack.hs
+++ b/compiler/GHC/Driver/Backpack.hs
@@ -769,6 +769,7 @@ summariseRequirement pn mod_name = do
ms_hie_date = hie_timestamp,
ms_srcimps = [],
ms_textual_imps = extra_sig_imports,
+ ms_ghc_prim_import = False,
ms_parsed_mod = Just (HsParsedModule {
hpm_module = L loc (HsModule {
hsmodAnn = noAnn,
@@ -854,8 +855,9 @@ hsModuleToModSummary pn hsc_src modname
let (src_idecls, ord_idecls) = partition ((== IsBoot) . ideclSource . unLoc) imps
-- GHC.Prim doesn't exist physically, so don't go looking for it.
- ordinary_imps = filter ((/= moduleName gHC_PRIM) . unLoc . ideclName . unLoc)
- ord_idecls
+ (ordinary_imps, ghc_prim_import)
+ = partition ((/= moduleName gHC_PRIM) . unLoc . ideclName . unLoc)
+ ord_idecls
implicit_prelude = xopt LangExt.ImplicitPrelude dflags
implicit_imports = mkPrelImports modname loc
@@ -884,6 +886,7 @@ hsModuleToModSummary pn hsc_src modname
ms_hspp_opts = dflags,
ms_hspp_buf = Nothing,
ms_srcimps = map convImport src_idecls,
+ ms_ghc_prim_import = not (null ghc_prim_import),
ms_textual_imps = normal_imports
-- We have to do something special here:
-- due to merging, requirements may end up with