diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-09-27 16:24:57 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-09-27 16:29:53 +0100 |
commit | a05bb1d6a1d963d14cb0bafade1e7c1072ac94a5 (patch) | |
tree | a716abfdb348a879914f7ef9401a6a9ae3cb080f /compiler | |
parent | 33eb4a4e396e76cf8122a97734d0e8cdd850c747 (diff) | |
download | haskell-wip/t20417.tar.gz |
Recompilation: Handle -plugin-package correctlywip/t20417
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 |