Skip to content

Commit 421ceee

Browse files
committed
Fix 9.4 build
1 parent de12e36 commit 421ceee

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ import qualified GHC.Types.Error as Error
137137
#if MIN_VERSION_ghc(9,5,0)
138138
import GHC.Driver.Config.CoreToStg.Prep
139139
import GHC.Core.Lint.Interactive
140-
import GHC.Driver.Main (mkCgInteractiveGuts)
141-
import GHC.Unit.Home.ModInfo
142140
#endif
143141

144142
-- | Given a string buffer, return the string (after preprocessing) and the 'ParsedModule'.

ghcide/src/Development/IDE/GHC/Compat/Core.hs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,15 @@ module Development.IDE.GHC.Compat.Core (
486486
Extension(..),
487487
#endif
488488
UniqFM,
489+
mkCgInteractiveGuts,
490+
justBytecode,
491+
justObjects,
492+
emptyHomeModInfoLinkable,
493+
homeModInfoByteCode,
494+
homeModInfoObject,
495+
# if !MIN_VERSION_ghc(9,5,0)
496+
field_label,
497+
#endif
489498
) where
490499

491500
import qualified GHC
@@ -1187,4 +1196,29 @@ type UniqFM k = UniqFM.UniqFM
11871196
mkVisFunTys = mkScaledFunctionTys
11881197
mapLoc :: (a -> b) -> SrcLoc.GenLocated l a -> SrcLoc.GenLocated l b
11891198
mapLoc = fmap
1199+
#else
1200+
mapLoc :: (a -> b) -> SrcLoc.GenLocated l a -> SrcLoc.GenLocated l b
1201+
mapLoc = SrcLoc.mapLoc
1202+
#endif
1203+
1204+
1205+
#if !MIN_VERSION_ghc(9,5,0)
1206+
mkCgInteractiveGuts :: CgGuts -> CgGuts
1207+
mkCgInteractiveGuts = id
1208+
1209+
emptyHomeModInfoLinkable :: Maybe Linkable
1210+
emptyHomeModInfoLinkable = Nothing
1211+
1212+
justBytecode :: Linkable -> Maybe Linkable
1213+
justBytecode = Just
1214+
1215+
justObjects :: Linkable -> Maybe Linkable
1216+
justObjects = Just
1217+
1218+
homeModInfoByteCode, homeModInfoObject :: HomeModInfo -> Maybe Linkable
1219+
homeModInfoByteCode = hm_linkable
1220+
homeModInfoObject = hm_linkable
1221+
1222+
field_label :: a -> a
1223+
field_label = id
11901224
#endif

ghcide/src/Development/IDE/GHC/Compat/Outputable.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ module Development.IDE.GHC.Compat.Outputable (
3434
mkWarnMsg,
3535
mkSrcErr,
3636
srcErrorMessages,
37+
textDoc,
3738
) where
3839

3940

@@ -85,7 +86,7 @@ import GHC.Driver.Config.Diagnostic
8586
import GHC.Utils.Logger
8687
#endif
8788

88-
#if MIN_VERSION_ghc(9,3,0)
89+
#if MIN_VERSION_ghc(9,5,0)
8990
type PrintUnqualified = NamePprCtx
9091
#endif
9192

@@ -247,3 +248,6 @@ defaultUserStyle = Out.defaultUserStyle
247248
#else
248249
defaultUserStyle = Out.defaultUserStyle unsafeGlobalDynFlags
249250
#endif
251+
252+
textDoc :: String -> SDoc
253+
textDoc = text

ghcide/src/Development/IDE/LSP/Outline.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ where
1111

1212
import Control.Monad.IO.Class
1313
import Data.Functor
14+
import Data.Foldable (toList)
1415
import Data.Generics hiding (Prefix)
1516
import Data.Maybe
1617
import qualified Data.Text as T
@@ -30,7 +31,7 @@ import Language.LSP.Types (DocumentSymbol (..),
3031
TextDocumentIdentifier (TextDocumentIdentifier),
3132
type (|?) (InL), uriToFilePath)
3233
#if MIN_VERSION_ghc(9,2,0)
33-
import Data.List.NonEmpty (nonEmpty, toList)
34+
import Data.List.NonEmpty (nonEmpty)
3435
#endif
3536

3637
moduleOutline

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ getCContext pos pm
141141
importGo :: GHC.LImportDecl GhcPs -> Maybe Context
142142
importGo (L (locA -> r) impDecl)
143143
| pos `isInsideSrcSpan` r
144+
#if MIN_VERSION_ghc(9,5,0)
144145
= importInline importModuleName (fmap (fmap reLoc) $ ideclImportList impDecl)
146+
#else
147+
= importInline importModuleName (fmap (fmap reLoc) $ ideclHiding impDecl)
148+
#endif
145149
<|> Just (ImportContext importModuleName)
146150

147151
| otherwise = Nothing

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ instance NFData ExportsMap where
5151
instance Show ExportsMap where
5252
show (ExportsMap occs mods) =
5353
unwords [ "ExportsMap { getExportsMap ="
54-
, printWithoutUniques $ mapOccEnv (text @SDoc . show) occs
54+
, printWithoutUniques $ mapOccEnv (textDoc . show) occs
5555
, "getModuleExportsMap ="
56-
, printWithoutUniques $ mapUFM (text @SDoc . show) mods
56+
, printWithoutUniques $ mapUFM (textDoc . show) mods
5757
, "}"
5858
]
5959

0 commit comments

Comments
 (0)