File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
ghcide/src/Development/IDE/Core Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -160,8 +160,7 @@ computePackageDeps env pkg = do
160160
161161data TypecheckHelpers
162162 = TypecheckHelpers
163- { getLinkablesToKeep :: ! (IO (ModuleEnv UTCTime ))
164- , getLinkables :: ! ([NormalizedFilePath ] -> IO [LinkableResult ])
163+ { getLinkables :: ! ([NormalizedFilePath ] -> IO [LinkableResult ])
165164 }
166165
167166typecheckModule :: IdeDefer
@@ -327,11 +326,6 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do
327326 ]
328327 ; let hsc_env' = loadModulesHome (map linkableHomeMod lbs) hsc_env
329328
330- -- Essential to do this here after we load the linkables
331- ; keep_lbls <- getLinkablesToKeep
332-
333- ; unload hsc_env' $ map (\ (mod , time) -> LM time mod [] ) $ moduleEnvToList keep_lbls
334-
335329#if MIN_VERSION_ghc(9,3,0)
336330 {- load it -}
337331 ; (fv_hvs, lbss, pkgs) <- loadDecls (hscInterp hsc_env') hsc_env' srcspan bcos
Original file line number Diff line number Diff line change @@ -694,8 +694,7 @@ typeCheckRuleDefinition hsc pm = do
694694
695695 unlift <- askUnliftIO
696696 let dets = TypecheckHelpers
697- { getLinkablesToKeep = unliftIO unlift currentLinkables
698- , getLinkables = unliftIO unlift . uses_ GetLinkable
697+ { getLinkables = unliftIO unlift . uses_ GetLinkable
699698 }
700699 addUsageDependencies $ liftIO $
701700 typecheckModule defer hsc dets pm
@@ -1108,7 +1107,10 @@ getLinkableRule recorder =
11081107 -- Record the linkable so we know not to unload it
11091108 whenJust (hm_linkable =<< hmi) $ \ (LM time mod _) -> do
11101109 compiledLinkables <- getCompiledLinkables <$> getIdeGlobalAction
1111- liftIO $ void $ modifyVar' compiledLinkables $ \ old -> extendModuleEnv old mod time
1110+ liftIO $ modifyVar compiledLinkables $ \ old -> do
1111+ let ! to_keep = extendModuleEnv old mod time
1112+ unload (hscEnv session) (map (\ (mod , time) -> LM time mod [] ) $ moduleEnvToList to_keep)
1113+ return (to_keep, () )
11121114 return (hash <$ hmi, (warns, LinkableResult <$> hmi <*> pure hash))
11131115
11141116-- | For now we always use bytecode unless something uses unboxed sums and tuples along with TH
You can’t perform that action at this time.
0 commit comments