diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-09-27 16:24:57 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-30 19:42:19 -0400 |
commit | 94f3ce7e4a4e0c952687eef511aa68cc38b1ad0d (patch) | |
tree | 7581c4ed9e50c473f8e6f2be5130c3739bad0d69 /compiler | |
parent | adc41a7747a72a526dd30e63afb03c61cee13e9a (diff) | |
download | haskell-94f3ce7e4a4e0c952687eef511aa68cc38b1ad0d.tar.gz |
Recompilation: Handle -plugin-package correctly
If a plugins was specified using the -plugin-package-(id) flag then the
module it applied to was always recompiled.
The recompilation checker was previously using `findImportedModule`,
which looked for packages in the HPT and then in the package database
but only for modules specified using `-package`.
The correct lookup function for plugins is `findPluginModule`, therefore
we check normal imports with `findImportedModule` and plugins with
`findPluginModule`.
Fixes #20417
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Iface/Recomp.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs index 4cc03d488d..6bbf8f58cb 100644 --- a/compiler/GHC/Iface/Recomp.hs +++ b/compiler/GHC/Iface/Recomp.hs @@ -506,11 +506,9 @@ checkMergedSignatures hsc_env mod_summary iface = do checkDependencies :: HscEnv -> ModSummary -> ModIface -> IfG RecompileRequired checkDependencies hsc_env summary iface = do - res <- liftIO $ traverse (\(mb_pkg, L _ mod) -> - let reason = ModuleChanged mod - in classify reason <$> findImportedModule fc fopts units home_unit mod (mb_pkg)) - (ms_imps summary ++ ms_srcimps summary) - case sequence (res ++ [Right (fake_ghc_prim_import)| ms_ghc_prim_import summary]) of + res_normal <- classify_import (findImportedModule fc fopts units home_unit) (ms_textual_imps summary ++ ms_srcimps summary) + res_plugin <- classify_import (\mod _ -> findPluginModule fc fopts units home_unit mod) (ms_plugin_imps summary) + case sequence (res_normal ++ res_plugin ++ [Right (fake_ghc_prim_import)| ms_ghc_prim_import summary]) of Left recomp -> return recomp Right es -> do let (hs, ps) = partitionEithers es @@ -520,6 +518,12 @@ checkDependencies hsc_env summary iface res2 <- liftIO $ check_packages allPkgDeps prev_dep_pkgs return (res1 `mappend` res2) where + + classify_import find_import imports = + liftIO $ traverse (\(mb_pkg, L _ mod) -> + let reason = ModuleChanged mod + in classify reason <$> find_import mod mb_pkg) + imports dflags = hsc_dflags hsc_env fopts = initFinderOpts dflags logger = hsc_logger hsc_env |