summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Pipeline
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/Pipeline
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/Pipeline')
-rw-r--r--compiler/GHC/Driver/Pipeline/Execute.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/GHC/Driver/Pipeline/Execute.hs b/compiler/GHC/Driver/Pipeline/Execute.hs
index 57d491104e..022e8ce1a1 100644
--- a/compiler/GHC/Driver/Pipeline/Execute.hs
+++ b/compiler/GHC/Driver/Pipeline/Execute.hs
@@ -632,15 +632,15 @@ runHscPhase pipe_env hsc_env0 input_fn src_flavour = do
-- gather the imports and module name
- (hspp_buf,mod_name,imps,src_imps) <- do
+ (hspp_buf,mod_name,imps,src_imps, ghc_prim_imp) <- do
buf <- hGetStringBuffer input_fn
let imp_prelude = xopt LangExt.ImplicitPrelude dflags
popts = initParserOpts dflags
eimps <- getImports popts imp_prelude buf input_fn (basename <.> suff)
case eimps of
Left errs -> throwErrors (GhcPsMessage <$> errs)
- Right (src_imps,imps,L _ mod_name) -> return
- (Just buf, mod_name, imps, src_imps)
+ Right (src_imps,imps, ghc_prim_imp, L _ mod_name) -> return
+ (Just buf, mod_name, imps, src_imps, ghc_prim_imp)
-- Take -o into account if present
-- Very like -ohi, but we must *only* do this if we aren't linking
@@ -679,6 +679,7 @@ runHscPhase pipe_env hsc_env0 input_fn src_flavour = do
ms_parsed_mod = Nothing,
ms_iface_date = hi_date,
ms_hie_date = hie_date,
+ ms_ghc_prim_import = ghc_prim_imp,
ms_textual_imps = imps,
ms_srcimps = src_imps }