diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-06-21 16:00:40 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-06-25 15:41:58 -0400 |
commit | 6cc8076684db27e9bb3e320421e844a7cbcb2545 (patch) | |
tree | a7c0585e9e235bcc4f63c4b8a19520ffd21fc011 /compiler/GHC/Rename | |
parent | 0bb78838e213467b9b5bd2b38767b39b46a294c5 (diff) | |
download | haskell-6cc8076684db27e9bb3e320421e844a7cbcb2545.tar.gz |
driver: Add implicit package dependencies for template-haskell package
When TemplateHaskellQuotes is enabled, we also generate programs which
mention symbols from the template-haskell module. So that package is
added conditionally if the extension is turned on.
We should really do the same for other wired-in packages:
* base
* ghc-bignum
* ghc-prim
* rts
When we link an executable, we must also link against these
libraries. In accordance with every other package, these dependencies
should be added into the direct dependencies for a module automatically
and end up in the interface file to record the fact the object file was
created by linking against these packages.
Unfortunately it is not so easy to work out when symbols from each of
these libraries ends up in the generated program. You might think that
`base` would always be used but the `ghc-prim` package doesn't depend
on `base`, so you have to be a bit careful and this futher enhancement
is left to a future patch.
Diffstat (limited to 'compiler/GHC/Rename')
-rw-r--r-- | compiler/GHC/Rename/Names.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs index 7fbbb7167e..4a8e80dca2 100644 --- a/compiler/GHC/Rename/Names.hs +++ b/compiler/GHC/Rename/Names.hs @@ -94,6 +94,7 @@ import qualified Data.Set as S import System.FilePath ((</>)) import System.IO +import GHC.Unit.State {- ************************************************************************ @@ -200,7 +201,11 @@ rnImports imports = do -- Safe Haskell: See Note [Tracking Trust Transitively] let (decls, rdr_env, imp_avails, hpc_usage) = combine (stuff1 ++ stuff2) -- Update imp_boot_mods if imp_direct_mods mentions any of them - let final_import_avail = clobberSourceImports imp_avails + let merged_import_avail = clobberSourceImports imp_avails + dflags <- getDynFlags + let final_import_avail = + merged_import_avail { imp_dep_direct_pkgs = S.fromList (implicitPackageDeps dflags) + `S.union` imp_dep_direct_pkgs merged_import_avail} return (decls, rdr_env, final_import_avail, hpc_usage) where |