Skip to content

Sort out some compatibility issues #2511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions ghcide/src/Development/IDE/GHC/Compat/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ module Development.IDE.GHC.Compat.Core (
TyCoRep.CoercionTy
),
pattern FunTy,
#if !MIN_VERSION_ghc(9,2,0)
Development.IDE.GHC.Compat.Core.splitForAllTyCoVars,
#endif
Development.IDE.GHC.Compat.Core.mkVisFunTys,
Development.IDE.GHC.Compat.Core.mkInfForAllTys,
-- * Specs
Expand Down Expand Up @@ -234,7 +236,9 @@ module Development.IDE.GHC.Compat.Core (
Unlinked(..),
Linkable(..),
unload,
#if !MIN_VERSION_ghc(9,2,0)
initDynLinker,
#endif
-- * Hooks
Hooks,
runMetaHook,
Expand Down Expand Up @@ -426,7 +430,7 @@ import GHC.Core.Coercion
import GHC.Core.ConLike
import GHC.Core.DataCon hiding (dataConExTyCoVars)
import qualified GHC.Core.DataCon as DataCon
import GHC.Core.FamInstEnv
import GHC.Core.FamInstEnv hiding (pprFamInst)
import GHC.Core.InstEnv
import GHC.Types.Unique.FM
#if MIN_VERSION_ghc(9,2,0)
Expand All @@ -444,6 +448,7 @@ import GHC.Core.Type hiding (mkInfForAllTys, mkVisFunTys)
import GHC.Core.Unify
import GHC.Core.Utils


#if MIN_VERSION_ghc(9,2,0)
import GHC.Driver.Env
#else
Expand All @@ -460,6 +465,9 @@ import GHC.Driver.Pipeline
import GHC.Driver.Plugins
import GHC.Driver.Session hiding (ExposePackage)
import qualified GHC.Driver.Session as DynFlags
#if MIN_VERSION_ghc(9,2,0)
import GHC.Hs (HsParsedModule(..))
#endif
#if !MIN_VERSION_ghc(9,2,0)
import GHC.Hs
#endif
Expand All @@ -480,6 +488,7 @@ import GHC.Parser.Lexer
import GHC.Linker.Loader
import GHC.Linker.Types
import GHC.Platform.Ways
import GHC.Runtime.Context (InteractiveImport(..))
#else
import GHC.Runtime.Linker
#endif
Expand All @@ -497,6 +506,9 @@ import GHC.Tc.Utils.Monad hiding (Applicative (..), IORef,
import GHC.Tc.Utils.TcType as TcType
import qualified GHC.Types.Avail as Avail
#if MIN_VERSION_ghc(9,2,0)
import GHC.Types.Fixity (LexicalFixity(..))
#endif
#if MIN_VERSION_ghc(9,2,0)
import GHC.Types.Meta
#endif
import GHC.Types.Basic
Expand All @@ -510,6 +522,7 @@ import GHC.Types.Name.Set
import GHC.Types.SourceFile (HscSource (..),
SourceModified (..))
import GHC.Types.SourceText
import GHC.Types.Target (Target(..), TargetId(..))
import GHC.Types.TyThing
import GHC.Types.TyThing.Ppr
#else
Expand All @@ -532,10 +545,12 @@ import GHC.Unit.Module hiding (ModLocation (..), UnitId,
toUnitId)
import qualified GHC.Unit.Module as Module
#if MIN_VERSION_ghc(9,2,0)
import GHC.Unit.Module.Graph (mkModuleGraph)
import GHC.Unit.Module.Imported
import GHC.Unit.Module.ModDetails
import GHC.Unit.Module.ModGuts
import GHC.Unit.Module.ModIface (IfaceExport)
import GHC.Unit.Module.ModIface (IfaceExport, ModIface(..), ModIface_(..))
import GHC.Unit.Module.ModSummary (ModSummary(..))
#endif
import GHC.Unit.State (ModuleOrigin (..))
import GHC.Utils.Error (Severity (..))
Expand Down Expand Up @@ -658,6 +673,11 @@ import Data.List (isSuffixOf)
import System.FilePath
#endif


#if MIN_VERSION_ghc(9,2,0)
import Language.Haskell.Syntax.Expr
#endif

#if !MIN_VERSION_ghc(9,0,0)
type BufSpan = ()
type BufPos = ()
Expand Down Expand Up @@ -806,11 +826,9 @@ mkInfForAllTys =
mkInvForAllTys
#endif

#if !MIN_VERSION_ghc(9,2,0)
splitForAllTyCoVars :: Type -> ([TyCoVar], Type)
splitForAllTyCoVars =
#if MIN_VERSION_ghc(9,2,0)
TcType.splitForAllTyCoVars
#else
splitForAllTys
#endif

Expand Down
7 changes: 7 additions & 0 deletions ghcide/src/Development/IDE/GHC/Compat/Outputable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import GHC.Parser.Errors
import qualified GHC.Parser.Errors.Ppr as Ppr
import qualified GHC.Types.Error as Error
import GHC.Types.Name.Ppr
import GHC.Types.Name.Reader
import GHC.Types.SourceError
import GHC.Types.SrcLoc
import GHC.Unit.State
Expand Down Expand Up @@ -154,7 +155,13 @@ type PsError = ErrMsg

mkPrintUnqualifiedDefault :: GlobalRdrEnv -> PrintUnqualified
mkPrintUnqualifiedDefault =
#if MIN_VERSION_ghc(9,2,0)
-- GHC 9.2.1 version
-- mkPrintUnqualified :: UnitEnv -> GlobalRdrEnv -> PrintUnqualified
mkPrintUnqualified unsafeGlobalDynFlags
#else
HscTypes.mkPrintUnqualified unsafeGlobalDynFlags
#endif

mkWarnMsg :: DynFlags -> SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc
mkWarnMsg =
Expand Down