summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen/Export.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-11-12 10:36:58 +0100
committerSylvain Henry <sylvain@haskus.fr>2020-12-14 19:45:13 +0100
commitd0e8c10d587e4b9984526d0dfcfcb258b75733b8 (patch)
treee0993719d76f87a0f4f8eccef089526217bf5bb4 /compiler/GHC/Tc/Gen/Export.hs
parent92377c27e1a48d0d3776f65c7074dfeb122b46db (diff)
downloadhaskell-d0e8c10d587e4b9984526d0dfcfcb258b75733b8.tar.gz
Move Unit related fields from DynFlags to HscEnv
The unit database cache, the home unit and the unit state were stored in DynFlags while they ought to be stored in the compiler session state (HscEnv). This patch fixes this. It introduces a new UnitEnv type that should be used in the future to handle separate unit environments (especially host vs target units). Related to #17957 Bump haddock submodule
Diffstat (limited to 'compiler/GHC/Tc/Gen/Export.hs')
-rw-r--r--compiler/GHC/Tc/Gen/Export.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Gen/Export.hs b/compiler/GHC/Tc/Gen/Export.hs
index d5420a4027..0e730a0b84 100644
--- a/compiler/GHC/Tc/Gen/Export.hs
+++ b/compiler/GHC/Tc/Gen/Export.hs
@@ -27,6 +27,7 @@ import GHC.Core.PatSyn
import GHC.Data.Maybe
import GHC.Utils.Misc (capitalise)
import GHC.Data.FastString (fsLit)
+import GHC.Driver.Env
import GHC.Types.Unique.Set
import GHC.Types.SrcLoc as SrcLoc
@@ -172,7 +173,8 @@ tcRnExports explicit_mod exports
-- thing (especially via 'module Foo' export item)
do {
; dflags <- getDynFlags
- ; let is_main_mod = mainModIs dflags == this_mod
+ ; hsc_env <- getTopEnv
+ ; let is_main_mod = mainModIs hsc_env == this_mod
; let default_main = case mainFunIs dflags of
Just main_fun
| is_main_mod -> mkUnqual varName (fsLit main_fun)