@@ -245,13 +245,6 @@ runEvalCmd plId st EvalParams{..} =
245
245
246
246
now <- liftIO getCurrentTime
247
247
248
- let modName = moduleName $ ms_mod ms
249
- thisModuleTarget =
250
- Target
251
- (TargetFile fp Nothing )
252
- False
253
- (stringToUnitId " blah-0.1.0.0-inplace" )
254
- (Just (textToStringBuffer mdlText, now))
255
248
256
249
-- Setup environment for evaluation
257
250
hscEnv' <- ExceptT $ fmap join $ liftIO . gStrictTry . evalGhcEnv session $ do
@@ -309,6 +302,15 @@ runEvalCmd plId st EvalParams{..} =
309
302
-- BUG: this fails for files that requires preprocessors (e.g. CPP) for ghc < 8.8
310
303
-- see https://gitlab.haskell.org/ghc/ghc/-/issues/17066
311
304
-- and https://hackage.haskell.org/package/ghc-8.10.1/docs/GHC.html#v:TargetFile
305
+ let modName = moduleName $ ms_mod ms
306
+ thisModuleTarget =
307
+ Target
308
+ (TargetFile fp Nothing )
309
+ False
310
+ #if MIN_VERSION_ghc(9,3,0)
311
+ (homeUnitId_ $ hsc_dflags session)
312
+ #endif
313
+ (Just (textToStringBuffer mdlText, now))
312
314
eSetTarget <- gStrictTry $ setTargets [thisModuleTarget]
313
315
dbg " setTarget" eSetTarget
314
316
@@ -332,9 +334,12 @@ runEvalCmd plId st EvalParams{..} =
332
334
lbs <- liftIO $ runAction " eval: GetLinkables" st $ do
333
335
linkables_needed <- reachableModules <$> use_ GetDependencyInformation nfp
334
336
uses_ GetLinkable (filter (/= nfp) linkables_needed) -- We don't need the linkable for the current module
335
- -- let hscEnv'' = hscEnv' { hsc_HPT = addListToHpt (hsc_HPT hscEnv') [(moduleName $ mi_module $ hm_iface hm, hm) | lb <- lbs, let hm = linkableHomeMod lb] }
336
- let hscEnv'' = hscUpdateHPT (flip addListToHpt [(moduleName $ mi_module $ hm_iface hm, hm) | lb <- lbs, let hm = linkableHomeMod lb] ) hscEnv'
337
337
338
+ #if MIN_VERSION_ghc(9,3,0)
339
+ let hscEnv'' = hscUpdateHPT (flip addListToHpt [(moduleName $ mi_module $ hm_iface hm, hm) | lb <- lbs, let hm = linkableHomeMod lb] ) hscEnv'
340
+ #else
341
+ let hscEnv'' = hscEnv' { hsc_HPT = addListToHpt (hsc_HPT hscEnv') [(moduleName $ mi_module $ hm_iface hm, hm) | lb <- lbs, let hm = linkableHomeMod lb] }
342
+ #endif
338
343
edits <-
339
344
perf " edits" $
340
345
liftIO $
0 commit comments