@@ -110,27 +110,17 @@ import System.IO.Extra (fixIO, newTempFileWithin)
110
110
111
111
import GHC.Tc.Gen.Splice
112
112
113
- #if !MIN_VERSION_ghc(9,2,1)
114
- import GHC.Driver.Types
115
- #endif
116
113
117
- #if !MIN_VERSION_ghc(9,2,0)
118
- import qualified Data.IntMap.Strict as IntMap
119
- #endif
120
114
121
- #if MIN_VERSION_ghc(9,2,0)
122
115
import qualified GHC as G
123
- #endif
124
116
125
- #if MIN_VERSION_ghc(9,2,0) && !MIN_VERSION_ghc(9,3,0)
117
+ #if !MIN_VERSION_ghc(9,3,0)
126
118
import GHC (ModuleGraph )
127
119
#endif
128
120
129
- #if MIN_VERSION_ghc(9,2,1)
130
121
import GHC.Types.ForeignStubs
131
122
import GHC.Types.HpcInfo
132
123
import GHC.Types.TypeEnv
133
- #endif
134
124
135
125
#if !MIN_VERSION_ghc(9,3,0)
136
126
import Data.Map (Map )
@@ -265,7 +255,6 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do
265
255
; lintInteractiveExpr " hscCompileExpr" hsc_env prepd_expr
266
256
267
257
268
- #if MIN_VERSION_ghc(9,2,0)
269
258
; let iNTERACTIVELoc = G. ModLocation { ml_hs_file = Nothing ,
270
259
ml_hi_file = panic " hscCompileCoreExpr':ml_hi_file" ,
271
260
ml_obj_file = panic " hscCompileCoreExpr':ml_obj_file" ,
@@ -293,11 +282,6 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do
293
282
(icInteractiveModule ictxt)
294
283
stg_expr
295
284
[] Nothing
296
- #else
297
- {- Convert to BCOs -}
298
- ; bcos <- coreExprToBCOs hsc_env
299
- (icInteractiveModule (hsc_IC hsc_env)) prepd_expr
300
- #endif
301
285
302
286
-- Exclude wired-in names because we may not have read
303
287
-- their interface files, so getLinkDeps will fail
@@ -312,11 +296,7 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do
312
296
moduleName mod -- On <= 9.2, just the name is enough because all unit ids will be the same
313
297
#endif
314
298
315
- #if MIN_VERSION_ghc(9,2,0)
316
299
| n <- concatMap (uniqDSetToList . bcoFreeNames) $ bc_bcos bcos
317
- #else
318
- | n <- uniqDSetToList (bcoFreeNames bcos)
319
- #endif
320
300
, Just mod <- [nameModule_maybe n] -- Names from other modules
321
301
, not (isWiredInName n) -- Exclude wired-in names
322
302
, moduleUnitId mod `elem` home_unit_ids -- Only care about stuff from the home package set
@@ -357,13 +337,10 @@ captureSplicesAndDeps TypecheckHelpers{..} env k = do
357
337
{- load it -}
358
338
; (fv_hvs, lbss, pkgs) <- loadDecls (hscInterp hsc_env') hsc_env' srcspan bcos
359
339
; let hval = ((expectJust " hscCompileCoreExpr'" $ lookup (idName binding_id) fv_hvs), lbss, pkgs)
360
- #elif MIN_VERSION_ghc(9,2,0)
340
+ #else
361
341
{- load it -}
362
342
; fv_hvs <- loadDecls (hscInterp hsc_env') hsc_env' srcspan bcos
363
343
; let hval = (expectJust " hscCompileCoreExpr'" $ lookup (idName binding_id) fv_hvs)
364
- #else
365
- {- link it -}
366
- ; hval <- linkExpr hsc_env' srcspan bcos
367
344
#endif
368
345
369
346
; modifyIORef' var (flip extendModuleEnvList [(mi_module $ hm_iface hm, linkableHash lb) | lb <- lbs, let hm = linkableHomeMod lb])
@@ -881,7 +858,7 @@ generateHieAsts hscEnv tcm =
881
858
where
882
859
dflags = hsc_dflags hscEnv
883
860
run _ts = -- ts is only used in GHC 9.2
884
- #if MIN_VERSION_ghc(9,2,0) && !MIN_VERSION_ghc(9,3,0)
861
+ #if !MIN_VERSION_ghc(9,3,0)
885
862
fmap (join . snd ) . liftIO . initDs hscEnv _ts
886
863
#else
887
864
id
@@ -1189,15 +1166,15 @@ getModSummaryFromImports env fp _modTime mContents = do
1189
1166
1190
1167
1191
1168
convImport (L _ i) = (
1192
- #if !MIN_VERSION_ghc (9,3,0)
1169
+ #if !MIN_VERSION_ghc(9,3,0)
1193
1170
fmap sl_fs
1194
1171
#endif
1195
1172
(ideclPkgQual i)
1196
1173
, reLoc $ ideclName i)
1197
1174
1198
1175
msrImports = implicit_imports ++ imps
1199
1176
1200
- #if MIN_VERSION_ghc (9,3,0)
1177
+ #if MIN_VERSION_ghc(9,3,0)
1201
1178
rn_pkg_qual = renameRawPkgQual (hsc_unit_env ppEnv)
1202
1179
rn_imps = fmap (\ (pk, lmn@ (L _ mn)) -> (rn_pkg_qual mn pk, lmn))
1203
1180
srcImports = rn_imps $ map convImport src_idecls
@@ -1714,9 +1691,6 @@ getDocsBatch hsc_env _names = do
1714
1691
#else
1715
1692
Map. lookup name dmap ,
1716
1693
#endif
1717
- #if !MIN_VERSION_ghc(9,2,0)
1718
- IntMap. fromAscList $ Map. toAscList $
1719
- #endif
1720
1694
#if MIN_VERSION_ghc(9,3,0)
1721
1695
lookupWithDefaultUniqMap amap mempty name))
1722
1696
#else
@@ -1739,12 +1713,7 @@ lookupName :: HscEnv
1739
1713
lookupName _ name
1740
1714
| Nothing <- nameModule_maybe name = pure Nothing
1741
1715
lookupName hsc_env name = exceptionHandle $ do
1742
- #if MIN_VERSION_ghc(9,2,0)
1743
1716
mb_thing <- liftIO $ lookupType hsc_env name
1744
- #else
1745
- eps <- liftIO $ readIORef (hsc_EPS hsc_env)
1746
- let mb_thing = lookupType (hsc_dflags hsc_env) (hsc_HPT hsc_env) (eps_PTE eps) name
1747
- #endif
1748
1717
case mb_thing of
1749
1718
x@ (Just _) -> return x
1750
1719
Nothing
0 commit comments