ghc-tcplugin-api 0.10.0.0 → 0.11.0.0
raw patch · 4 files changed
+68/−11 lines, 4 filesdep ~basedep ~containersdep ~ghcPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, containers, ghc
API changes (from Hackage documentation)
+ GHC.TcPlugin.API: data InertSet
+ GHC.TcPlugin.API: data TcS a
+ GHC.TcPlugin.API: getInertSet :: TcS InertSet
+ GHC.TcPlugin.API: getTcEvBindsMap :: EvBindsVar -> TcS EvBindMap
+ GHC.TcPlugin.API: readTcRef :: TcRef a -> TcRnIf gbl lcl a
+ GHC.TcPlugin.API: setInertSet :: InertSet -> TcS ()
+ GHC.TcPlugin.API: setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcS ()
+ GHC.TcPlugin.API: writeTcRef :: TcRef a -> a -> TcRnIf gbl lcl ()
Files
- changelog.md +11/−1
- ghc-tcplugin-api.cabal +3/−3
- src/GHC/TcPlugin/API.hs +40/−1
- src/GHC/TcPlugin/API/Names.hs +14/−6
changelog.md view
@@ -1,8 +1,18 @@+# Version 0.11.0.0 (2023-08-29) + +- Add support for GHC 9.8. + +- Re-export functionality relating to GHC's constraint solving `TcS` monad, + such as `{get,set}InertSet`, `{get,set}TcEvBindsMap`. + +- Re-export `readTcRef` and `writeTcRef`. + # Version 0.10.0.0 (2023-02-28) - Introduce `resolveImport`, and make `PkgQual` opaque. + - Rename `tcRewriterWanteds` to `tcRewriterNewWanteds` - (bringing it in line with nomenclature in ghc 9.4). + (bringing it in line with nomenclature in GHC 9.4). # Version 0.9.0.0 (2023-01-24)
ghc-tcplugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: ghc-tcplugin-api -version: 0.10.0.0 +version: 0.11.0.0 synopsis: An API for type-checker plugins. license: BSD-3-Clause build-type: Simple @@ -33,11 +33,11 @@ build-depends: base - >= 4.13.0 && < 4.19, + >= 4.13.0 && < 4.20, containers >= 0.6 && < 0.7, ghc - >= 8.8 && < 9.7, + >= 8.8 && < 9.9, transformers >= 0.5 && < 0.7,
src/GHC/TcPlugin/API.hs view
@@ -241,6 +241,7 @@ , isSkolemTyVar , isMetaTyVar, isFilledMetaTyVar_maybe , writeMetaTyVar + , readTcRef, writeTcRef -- | == Some further functions for inspecting constraints , eqType @@ -428,6 +429,11 @@ -- * The type-checking environment , getEnvs + -- * Interacting with GHC's constraint solver + , TcS + , InertSet, getInertSet, setInertSet + , getTcEvBindsMap, setTcEvBindsMap + -- * Built-in types -- | This module also re-exports the built-in types that GHC already knows about. @@ -579,6 +585,22 @@ ( FastString, fsLit, unpackFS ) import qualified GHC.Tc.Plugin as GHC +#if MIN_VERSION_ghc(9,4,0) +import GHC.Tc.Solver.InertSet + ( InertSet ) +#endif +import GHC.Tc.Solver.Monad + ( TcS +#if !MIN_VERSION_ghc(9,4,0) + , InertSet +#endif +#if MIN_VERSION_ghc(9,8,0) + , getInertSet, updInertSet +#else + , getTcSInerts, setTcSInerts +#endif + , getTcEvBindsMap, setTcEvBindsMap + ) import GHC.Tc.Types ( TcTyThing(..), TcGblEnv(..), TcLclEnv(..) #if HAS_REWRITING @@ -601,7 +623,7 @@ import GHC.Tc.Types.Origin ( CtOrigin(..) ) import GHC.Tc.Utils.Monad - ( newName ) + ( newName, readTcRef, writeTcRef ) import qualified GHC.Tc.Utils.Monad as GHC ( traceTc, setCtLocM ) @@ -1064,3 +1086,20 @@ #endif #endif + +-------------------------------------------------------------------------------- + +#if MIN_VERSION_ghc(9,8,0) +setInertSet :: InertSet -> TcS () +setInertSet inerts = updInertSet ( const inerts ) + -- workaround for setInertSet not being exported + +#elif !MIN_VERSION_ghc(9,8,0) +getInertSet :: TcS InertSet +getInertSet = getTcSInerts + +setInertSet :: InertSet -> TcS () +setInertSet = setTcSInerts +#endif + +--------------------------------------------------------------------------------
src/GHC/TcPlugin/API/Names.hs view
@@ -130,6 +130,10 @@ ( MonadTrans(lift) ) -- ghc +#if MIN_VERSION_ghc(9,8,0) +import GHC.Iface.Errors.Ppr + ( missingInterfaceErrorDiagnostic ) +#endif #if MIN_VERSION_ghc(9,3,0) import GHC.Iface.Errors ( cannotFindModule ) @@ -141,8 +145,6 @@ ( hsc_dflags ) import GHC.Driver.Finder ( cannotFindModule ) -import GHC.Driver.Session - ( DynFlags ) #endif #if MIN_VERSION_ghc(9,5,0) import Language.Haskell.Syntax.Module.Name @@ -155,6 +157,10 @@ ( pgmErrorDoc ) import GHC.Tc.Plugin ( getTopEnv ) +#if MIN_VERSION_ghc(9,8,0) +import GHC.Types.Error + ( HasDefaultDiagnosticOpts(defaultOpts) ) +#endif -- ghc-tcplugin-api import GHC.TcPlugin.API @@ -402,12 +408,14 @@ hsc_env <- lift . liftTcPluginM $ getTopEnv let err_doc :: SDoc + err_doc = +#if MIN_VERSION_ghc(9,8,0) + missingInterfaceErrorDiagnostic defaultOpts $ +#endif #if MIN_VERSION_ghc(9,2,0) - err_doc = cannotFindModule hsc_env mod_name other + cannotFindModule hsc_env mod_name other #else - err_doc = cannotFindModule dflags mod_name other - dflags :: DynFlags - dflags = hsc_dflags hsc_env + cannotFindModule (hsc_dflags hsc_env) mod_name other #endif pgmErrorDoc ( "GHC.TcPlugin.API: could not find module "