Skip to content
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

Support ghc 9.8 #170

Merged
merged 3 commits into from
Oct 14, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles(matrix.stack_yaml) }}

- uses: haskell/actions/setup@v2
- uses: haskell-actions/setup@v2
id: setup-haskell-stack
name: Setup Stack
with:
Expand Down Expand Up @@ -71,13 +71,13 @@ jobs:
strategy:
matrix:
include:
- ghc: latest
- ghc-version: '9.8.1'
os: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: haskell/actions/setup@v1
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Cabal
with:
Expand Down
3 changes: 2 additions & 1 deletion hint.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tested-with: ghc == 8.10.7
, ghc == 9.2.7
, ghc == 9.4.5
, ghc == 9.6.1
, ghc == 9.8.1

cabal-version: >= 1.10
build-type: Simple
Expand Down Expand Up @@ -71,7 +72,7 @@ library
default-language: Haskell2010
build-depends: base == 4.*,
containers,
ghc >= 8.4 && < 9.7,
ghc >= 8.4 && < 9.9,
ghc-paths,
ghc-boot,
transformers,
Expand Down
26 changes: 24 additions & 2 deletions src/Hint/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
)
import Control.Monad.Ghc as X (GhcT, runGhcT)

#if MIN_VERSION_ghc(9,8,0)
import GHC.Types.Error (ResolvedDiagnosticReason(..), Messages)
import GHC.Driver.Errors.Types (DriverMessage)
#endif

#if MIN_VERSION_ghc(9,4,0)
import GHC.Types.SourceError as X (SourceError, srcErrorMessages)

Expand Down Expand Up @@ -114,7 +119,7 @@

import GHC.Core.ConLike as X (ConLike(RealDataCon))
#else
import HscTypes as X (mgModSummaries)

Check warning on line 122 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.8.4.yaml

The import of ‘HscTypes’ is redundant

Check warning on line 122 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.10.7.yaml

The import of ‘HscTypes’ is redundant

import Outputable as X (PprStyle, SDoc, Outputable(ppr),
withPprStyle, vcat)
Expand All @@ -134,7 +139,7 @@

{-------------------- Imports for Shims --------------------}

import Control.Monad.IO.Class (MonadIO)

Check warning on line 142 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.8.4.yaml

The import of ‘Control.Monad.IO.Class’ is redundant

Check warning on line 142 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-9.0.2.yaml

The import of ‘Control.Monad.IO.Class’ is redundant

Check warning on line 142 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.10.7.yaml

The import of ‘Control.Monad.IO.Class’ is redundant

Check warning on line 142 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.6.5.yaml

The import of ‘Control.Monad.IO.Class’ is redundant
-- guessTarget
import qualified GHC (guessTarget)

Expand Down Expand Up @@ -182,7 +187,7 @@

-- parseDynamicFlags
import qualified GHC (parseDynamicFlags)
import GHC.Driver.CmdLine (Warn)

Check warning on line 190 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / newest (9.8.1, ubuntu-latest)

The import of ‘GHC.Driver.CmdLine’ is redundant

-- pprTypeForUser
import qualified GHC.Core.TyCo.Ppr as GHC (pprSigmaType)
Expand Down Expand Up @@ -342,7 +347,7 @@

-- parseDynamicFlags
import qualified GHC (parseDynamicFlags)
import GHC.Driver.CmdLine (Warn)

Check warning on line 350 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-9.0.2.yaml

The import of ‘GHC.Driver.CmdLine’ is redundant

-- pprTypeForUser
import qualified GHC.Core.Ppr.TyThing as GHC (pprTypeForUser)
Expand Down Expand Up @@ -391,7 +396,7 @@

-- parseDynamicFlags
import qualified GHC (parseDynamicFlags)
import CmdLineParser (Warn)

Check warning on line 399 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.8.4.yaml

The import of ‘CmdLineParser’ is redundant

Check warning on line 399 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.10.7.yaml

The import of ‘CmdLineParser’ is redundant

Check warning on line 399 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.6.5.yaml

The import of ‘CmdLineParser’ is redundant

-- pprTypeForUser
import qualified PprTyThing as GHC (pprTypeForUser)
Expand Down Expand Up @@ -429,7 +434,18 @@
pushLogHook :: (GHC.LogAction -> GHC.LogAction) -> Logger -> Logger
modifyLogger :: GhcMonad m => (Logger -> Logger) -> m ()
mkLogAction :: (String -> a) -> IORef [a] -> GHC.LogAction
#if MIN_VERSION_ghc(9,6,0)
#if MIN_VERSION_ghc(9,8,0)
data WarnReason = NoReason
type Logger = GHC.Logger
initLogger = GHC.initLogger
putLogMsg logger _df _wn sev = GHC.putLogMsg logger (GHC.logFlags logger) (GHC.MCDiagnostic sev (ResolvedDiagnosticReason GHC.ErrorWithoutFlag) Nothing)
pushLogHook = GHC.pushLogHook
modifyLogger = GHC.modifyLogger
mkLogAction f r = \lf mc src msg ->
let renderErrMsg = GHC.renderWithContext (GHC.log_default_user_context lf)
errorEntry = f (renderErrMsg (GHC.mkLocMessage mc src msg))
in modifyIORef r (errorEntry :)
#elif MIN_VERSION_ghc(9,6,0)
data WarnReason = NoReason
type Logger = GHC.Logger
initLogger = GHC.initLogger
Expand Down Expand Up @@ -606,12 +622,18 @@
#endif

-- parseDynamicFlags
parseDynamicFlags :: MonadIO m => Logger -> DynFlags -> [Located String] -> m (DynFlags, [Located String], [Warn])

#if MIN_VERSION_ghc(9,8,0)
parseDynamicFlags :: MonadIO m => Logger -> DynFlags -> [Located String] -> m (DynFlags, [Located String], Messages DriverMessage)
parseDynamicFlags = GHC.parseDynamicFlags
#else
#if MIN_VERSION_ghc(9,2,0)
parseDynamicFlags :: MonadIO m => Logger -> DynFlags -> [Located String] -> m (DynFlags, [Located String], [Warn])
parseDynamicFlags = GHC.parseDynamicFlags
#else
parseDynamicFlags _ = GHC.parseDynamicFlags

Check warning on line 634 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.8.4.yaml

Top-level binding with no type signature:

Check warning on line 634 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-9.0.2.yaml

Top-level binding with no type signature:

Check warning on line 634 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.10.7.yaml

Top-level binding with no type signature:

Check warning on line 634 in src/Hint/GHC.hs

View workflow job for this annotation

GitHub Actions / stack-8.6.5.yaml

Top-level binding with no type signature:
#endif
#endif

pprTypeForUser :: Type -> SDoc
#if MIN_VERSION_ghc(9,4,0)
Expand Down
Loading