Commit eda2c731 authored by Simon Marlow's avatar Simon Marlow
Browse files

Be less conservative about recompiling after changes to -main-is (#5878)

parent 0bca11de
......@@ -10,6 +10,7 @@ import Binary
import BinIface ()
import DynFlags
import HscTypes
import Module
import Name
import Fingerprint
-- import Outputable
......@@ -21,11 +22,11 @@ import System.FilePath (normalise)
-- | Produce a fingerprint of a @DynFlags@ value. We only base
-- the finger print on important fields in @DynFlags@ so that
-- the recompilation checker can use this fingerprint.
fingerprintDynFlags :: DynFlags -> (BinHandle -> Name -> IO ())
fingerprintDynFlags :: DynFlags -> Module -> (BinHandle -> Name -> IO ())
-> IO Fingerprint
fingerprintDynFlags DynFlags{..} nameio =
let mainis = (mainModIs, mainFunIs)
fingerprintDynFlags DynFlags{..} this_mod nameio =
let mainis = mainModIs == this_mod -- see #5878
-- pkgopts = (thisPackage dflags, sort $ packageFlags dflags)
safeHs = setSafeMode safeHaskell
-- oflags = sort $ filter filterOFlags $ flags dflags
......
......@@ -594,7 +594,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls
-- - (some of) dflags
-- it returns two hashes, one that shouldn't change
-- the abi hash and one that should
flag_hash <- fingerprintDynFlags dflags putNameLiterally
flag_hash <- fingerprintDynFlags dflags this_mod putNameLiterally
-- the ABI hash depends on:
-- - decls
......@@ -1222,7 +1222,9 @@ checkVersions hsc_env mod_summary iface
checkFlagHash :: HscEnv -> ModIface -> IfG RecompileRequired
checkFlagHash hsc_env iface = do
let old_hash = mi_flag_hash iface
new_hash <- liftIO $ fingerprintDynFlags (hsc_dflags hsc_env) putNameLiterally
new_hash <- liftIO $ fingerprintDynFlags (hsc_dflags hsc_env)
(mi_module iface)
putNameLiterally
case old_hash == new_hash of
True -> up_to_date (ptext $ sLit "Module flags unchanged")
False -> out_of_date_hash (ptext $ sLit " Module flags have changed")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment