From 9eb1641e0ef10a7887e794d4d114c9a18a2fd265 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Mon, 5 Jul 2021 14:16:35 +0100 Subject: 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 --- compiler/GHC/Driver/Pipeline/Execute.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'compiler/GHC/Driver/Pipeline') 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 } -- cgit v1.2.1