Skip to content

Commit

Permalink
Make sure to give the correct DynFlags to the recompilation checker
Browse files Browse the repository at this point in the history
We were passing the wrong DynFlags here, causing most modules with a LANGUAGE pragma
to fail the recompilation check and have their interface files regenerated
  • Loading branch information
pepeiborra committed Feb 28, 2021
1 parent 43b33a5 commit c83dabf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ghcide/src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ mkHiFileResultNoCompile session tcm = do
details <- makeSimpleDetails hsc_env_tmp tcGblEnv
sf <- finalSafeMode (ms_hspp_opts ms) tcGblEnv
#if MIN_GHC_API_VERSION(8,10,0)
iface <- mkIfaceTc session sf details tcGblEnv
iface <- mkIfaceTc hsc_env_tmp sf details tcGblEnv
#else
(iface, _) <- mkIfaceTc session Nothing sf details tcGblEnv
(iface, _) <- mkIfaceTc hsc_env_tmp Nothing sf details tcGblEnv
#endif
let mod_info = HomeModInfo iface details Nothing
pure $! HiFileResult ms mod_info
Expand Down Expand Up @@ -885,7 +885,8 @@ loadInterface
-> (Maybe LinkableType -> m ([FileDiagnostic], Maybe HiFileResult)) -- ^ Action to regenerate an interface
-> m ([FileDiagnostic], Maybe HiFileResult)
loadInterface session ms sourceMod linkableNeeded regen = do
res <- liftIO $ checkOldIface session ms sourceMod Nothing
let sessionWithMsDynFlags = session{hsc_dflags = ms_hspp_opts ms}
res <- liftIO $ checkOldIface sessionWithMsDynFlags ms sourceMod Nothing
case res of
(UpToDate, Just iface)
-- If the module used TH splices when it was last
Expand Down Expand Up @@ -914,7 +915,7 @@ loadInterface session ms sourceMod linkableNeeded regen = do
Just (LM obj_time _ _) -> obj_time > ms_hs_date ms
if objUpToDate
then do
hmi <- liftIO $ mkDetailsFromIface session iface linkable
hmi <- liftIO $ mkDetailsFromIface sessionWithMsDynFlags iface linkable
return ([], Just $ HiFileResult ms hmi)
else regen linkableNeeded
(_reason, _) -> regen linkableNeeded
Expand Down

0 comments on commit c83dabf

Please sign in to comment.