Skip to content

Commit 376ada0

Browse files
committed
Remove extra call to newHscEnvEqWithImportPaths
1 parent a726296 commit 376ada0

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

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

+3-24
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ import qualified Data.Text.Encoding as T
100100
import Data.Time (UTCTime (..))
101101
import Data.Tuple.Extra
102102
import Data.Typeable (cast)
103+
import qualified Data.Unique as Unique
103104
import Development.IDE.Core.Compile
104105
import Development.IDE.Core.FileExists hiding (LogShake, Log)
105106
import Development.IDE.Core.FileStore (getFileContents,
@@ -771,35 +772,13 @@ ghcSessionDepsDefinition
771772
Bool ->
772773
GhcSessionDepsConfig -> HscEnvEq -> NormalizedFilePath -> Action (Maybe HscEnvEq)
773774
ghcSessionDepsDefinition fullModSummary GhcSessionDepsConfig{..} env file = do
774-
let hsc = hscEnv env
775-
776775
mbdeps <- mapM(fmap artifactFilePath . snd) <$> use_ GetLocatedImports file
777776
case mbdeps of
778777
Nothing -> return Nothing
779778
Just deps -> do
780779
when checkForImportCycles $ void $ uses_ ReportImportCycles deps
781-
ms <- msrModSummary <$> if fullModSummary
782-
then use_ GetModSummary file
783-
else use_ GetModSummaryWithoutTimestamps file
784-
785-
depSessions <- map hscEnv <$> uses_ (GhcSessionDeps_ fullModSummary) deps
786-
ifaces <- uses_ GetModIface deps
787-
let inLoadOrder = map (\HiFileResult{..} -> HomeModInfo hirModIface hirModDetails emptyHomeModInfoLinkable) ifaces
788-
#if MIN_VERSION_ghc(9,3,0)
789-
-- On GHC 9.4+, the module graph contains not only ModSummary's but each `ModuleNode` in the graph
790-
-- also points to all the direct descendants of the current module. To get the keys for the descendants
791-
-- we must get their `ModSummary`s
792-
!final_deps <- do
793-
dep_mss <- map msrModSummary <$> uses_ GetModSummaryWithoutTimestamps deps
794-
-- Don't want to retain references to the entire ModSummary when just the key will do
795-
return $!! map (NodeKey_Module . msKey) dep_mss
796-
let moduleNode = (ms, final_deps)
797-
#else
798-
let moduleNode = ms
799-
#endif
800-
session' <- liftIO $ mergeEnvs hsc moduleNode inLoadOrder depSessions
801-
802-
Just <$> liftIO (newHscEnvEqWithImportPaths (envImportPaths env) session' [])
780+
let updateUnique newUnique = env { envUnique = newUnique }
781+
Just . updateUnique <$> liftIO Unique.newUnique
803782

804783
-- | Load a iface from disk, or generate it if there isn't one or it is out of date
805784
-- This rule also ensures that the `.hie` and `.o` (if needed) files are written out.

ghcide/src/Development/IDE/Types/HscEnvEq.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Development.IDE.Types.HscEnvEq
2-
( HscEnvEq,
2+
( HscEnvEq(envUnique),
33
hscEnv, newHscEnvEq,
44
hscEnvWithImportPaths,
55
newHscEnvEqPreserveImportPaths,

0 commit comments

Comments
 (0)