Skip to content

Commit c83dabf

Browse files
committed
Make sure to give the correct DynFlags to the recompilation checker
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
1 parent 43b33a5 commit c83dabf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

+5-4
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ mkHiFileResultNoCompile session tcm = do
235235
details <- makeSimpleDetails hsc_env_tmp tcGblEnv
236236
sf <- finalSafeMode (ms_hspp_opts ms) tcGblEnv
237237
#if MIN_GHC_API_VERSION(8,10,0)
238-
iface <- mkIfaceTc session sf details tcGblEnv
238+
iface <- mkIfaceTc hsc_env_tmp sf details tcGblEnv
239239
#else
240-
(iface, _) <- mkIfaceTc session Nothing sf details tcGblEnv
240+
(iface, _) <- mkIfaceTc hsc_env_tmp Nothing sf details tcGblEnv
241241
#endif
242242
let mod_info = HomeModInfo iface details Nothing
243243
pure $! HiFileResult ms mod_info
@@ -885,7 +885,8 @@ loadInterface
885885
-> (Maybe LinkableType -> m ([FileDiagnostic], Maybe HiFileResult)) -- ^ Action to regenerate an interface
886886
-> m ([FileDiagnostic], Maybe HiFileResult)
887887
loadInterface session ms sourceMod linkableNeeded regen = do
888-
res <- liftIO $ checkOldIface session ms sourceMod Nothing
888+
let sessionWithMsDynFlags = session{hsc_dflags = ms_hspp_opts ms}
889+
res <- liftIO $ checkOldIface sessionWithMsDynFlags ms sourceMod Nothing
889890
case res of
890891
(UpToDate, Just iface)
891892
-- If the module used TH splices when it was last
@@ -914,7 +915,7 @@ loadInterface session ms sourceMod linkableNeeded regen = do
914915
Just (LM obj_time _ _) -> obj_time > ms_hs_date ms
915916
if objUpToDate
916917
then do
917-
hmi <- liftIO $ mkDetailsFromIface session iface linkable
918+
hmi <- liftIO $ mkDetailsFromIface sessionWithMsDynFlags iface linkable
918919
return ([], Just $ HiFileResult ms hmi)
919920
else regen linkableNeeded
920921
(_reason, _) -> regen linkableNeeded

0 commit comments

Comments
 (0)