Skip to content

Commit c77dda0

Browse files
committed
Cleanup 9.4 leftovers, fix couple -Wunused-packages and import warnings
1 parent 177ca8e commit c77dda0

18 files changed

Lines changed: 38 additions & 92 deletions

File tree

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ shake.yaml.lock
2020
.vscode
2121
/test-logs/*.log
2222

23-
# stack 2.1 stack.yaml lock files
24-
stack*.yaml.lock
25-
shake.yaml.lock
26-
2723
# ignore hie.yaml's for testdata
2824
test/testdata/**/hie.yaml
2925

cabal.project

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,31 @@ if impl(ghc >= 9.11)
5959

6060
if impl(ghc >= 9.14)
6161
allow-newer:
62+
aeson:containers,
63+
aeson:template-haskell,
64+
aeson:time,
65+
binary-instances:base,
66+
binary-instances:tagged,
67+
binary-orphans:base,
68+
boring:base,
69+
cabal-install-parsers:containers,
70+
constraints-extras:template-haskell,
71+
dependent-map:containers,
72+
ghc-trace-events:base,
73+
hie-compat:base,
74+
indexed-traversable:base,
6275
indexed-traversable:containers,
76+
indexed-traversable-instances:base,
77+
lukko:base,
78+
quickcheck-instances:base,
6379
quickcheck-instances:containers,
64-
dependent-map:containers,
65-
aeson:containers,
80+
semialign:base,
6681
semialign:containers,
6782
string-interpolate:template-haskell,
6883
tasty-hspec:base,
69-
tagged:template-haskell,
70-
indexed-traversable:base,
71-
quickcheck-instances:base,
84+
text-iso8601:time,
85+
these:base,
7286
time-compat:base,
7387
time-compat:time,
74-
these:base,
75-
some:base,
76-
boring:base,
77-
indexed-traversable-instances:base,
7888
uuid-types:template-haskell,
79-
hie-compat:base,
80-
ghc-trace-events:base,
81-
constraints-extras:template-haskell,
82-
aeson:time,
83-
text-iso8601:time,
84-
semialign:base,
85-
aeson:template-haskell,
86-
lukko:base,
87-
binary-instances:base,
88-
binary-orphans:base,
89-
cabal-install-parsers:containers,
90-
haddock-library:base,
9189
websockets:containers,
92-
monad-control:transformers,
93-
mmorph:transformers-compat,
94-
binary-instances:tagged,

ghcide-test/exe/BootTests.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module BootTests (tests) where
22

3-
import Config (checkDefs, mkR, runInDir,
3+
import Config (checkDefs, mkR,
44
runWithExtraFiles)
55
import Control.Applicative.Combinators
66
import Control.Monad

ghcide-test/exe/DiagnosticTests.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Control.Monad
99
import Control.Monad.IO.Class (liftIO)
1010
import Data.List.Extra
1111
import qualified Data.Text as T
12-
import Development.IDE.GHC.Compat (GhcVersion (..), ghcVersion)
1312
import Development.IDE.GHC.Util
1413
import Development.IDE.Test (diagnostic,
1514
expectCurrentDiagnostics,
@@ -28,7 +27,6 @@ import Language.LSP.Protocol.Types hiding
2827
import Language.LSP.Test
2928
import System.Directory
3029
import System.FilePath
31-
import System.IO.Extra hiding (withTempDir)
3230

3331
import Config
3432
import Control.Lens ((^.))

ghcide-test/exe/IfaceTests.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Language.LSP.Protocol.Types hiding
1717
import Language.LSP.Test
1818
import System.Directory
1919
import System.FilePath
20-
import System.IO.Extra hiding (withTempDir)
2120
import Test.Hls.FileSystem
2221
import Test.Tasty
2322
import Test.Tasty.HUnit

ghcide/ghcide.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ library
8787
, mtl
8888
, opentelemetry >=0.6.1
8989
, optparse-applicative
90-
, os-string
9190
, parallel
9291
, process
9392
, prettyprinter >=1.7

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

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,13 +1172,10 @@ withBootSuffix _ = id
11721172
getModSummaryFromImports
11731173
:: HscEnv
11741174
-> FilePath
1175-
-> UTCTime
11761175
-> Maybe Util.StringBuffer
11771176
-> ExceptT [FileDiagnostic] IO ModSummaryResult
1178-
-- modTime is only used in GHC < 9.4
1179-
getModSummaryFromImports env fp _modTime mContents = do
1180-
-- src_hash is only used in GHC >= 9.4
1181-
(contents, opts, ppEnv, _src_hash) <- preprocessor env fp mContents
1177+
getModSummaryFromImports env fp mContents = do
1178+
(contents, opts, ppEnv, src_hash) <- preprocessor env fp mContents
11821179

11831180
let dflags = hsc_dflags ppEnv
11841181

@@ -1194,8 +1191,7 @@ getModSummaryFromImports env fp _modTime mContents = do
11941191
(src_idecls, ord_idecls) = partition ((== IsBoot) . ideclSource.unLoc) imps
11951192

11961193
-- GHC.Prim doesn't exist physically, so don't go looking for it.
1197-
-- ghc_prim_imports is only used in GHC >= 9.4
1198-
(ordinary_imps, _ghc_prim_imports)
1194+
(ordinary_imps, ghc_prim_imports)
11991195
= partition ((/= moduleName gHC_PRIM) . unLoc
12001196
. ideclName . unLoc)
12011197
ord_idecls
@@ -1233,7 +1229,7 @@ getModSummaryFromImports env fp _modTime mContents = do
12331229
srcImports = rn_imps $ map convImport src_idecls
12341230
textualImports = rn_imps $ map convImport (implicit_imports ++ ordinary_imps)
12351231
#endif
1236-
ghc_prim_import = not (null _ghc_prim_imports)
1232+
ghc_prim_import = not (null ghc_prim_imports)
12371233

12381234

12391235
-- Force bits that might keep the string buffer and DynFlags alive unnecessarily
@@ -1253,11 +1249,11 @@ getModSummaryFromImports env fp _modTime mContents = do
12531249
ModSummary
12541250
{ ms_mod = modl
12551251
, ms_hie_date = Nothing
1256-
, ms_dyn_obj_date = Nothing
1252+
, ms_dyn_obj_date = Nothing
12571253
#if !MIN_VERSION_ghc(9,13,0)
12581254
, ms_ghc_prim_import = ghc_prim_import
12591255
#endif
1260-
, ms_hs_hash = _src_hash
1256+
, ms_hs_hash = src_hash
12611257

12621258
, ms_hsc_src = sourceType
12631259
-- The contents are used by the GetModSummary rule
@@ -1539,25 +1535,15 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
15391535
Just ver -> pure $ Just ver
15401536
Nothing -> get_file_version (toNormalizedFilePath' iface_file)
15411537

1542-
-- The source is modified if it is newer than the destination (iface file)
1543-
-- A more precise check for the core file is performed later
1544-
let _sourceMod = case mb_dest_version of -- sourceMod is only used in GHC < 9.4
1545-
Nothing -> SourceModified -- destination file doesn't exist, assume modified source
1546-
Just dest_version
1547-
| source_version <= dest_version -> SourceUnmodified
1548-
| otherwise -> SourceModified
1549-
1550-
-- old_iface is only used in GHC >= 9.4
1551-
_old_iface <- case mb_old_iface of
1538+
old_iface <- case mb_old_iface of
15521539
Just iface -> pure (Just iface)
15531540
Nothing -> do
1554-
-- ncu and read_dflags are only used in GHC >= 9.4
1555-
let _ncu = hsc_NC sessionWithMsDynFlags
1556-
_read_dflags = hsc_dflags sessionWithMsDynFlags
1541+
let ncu = hsc_NC sessionWithMsDynFlags
1542+
read_dflags = hsc_dflags sessionWithMsDynFlags
15571543
#if MIN_VERSION_ghc(9,13,0)
1558-
read_result <- liftIO $ readIface (hsc_hooks sessionWithMsDynFlags) (hsc_logger sessionWithMsDynFlags) _read_dflags _ncu mod iface_file
1544+
read_result <- liftIO $ readIface (hsc_hooks sessionWithMsDynFlags) (hsc_logger sessionWithMsDynFlags) read_dflags ncu mod iface_file
15591545
#else
1560-
read_result <- liftIO $ readIface _read_dflags _ncu mod iface_file
1546+
read_result <- liftIO $ readIface read_dflags ncu mod iface_file
15611547
#endif
15621548
case read_result of
15631549
Util.Failed{} -> return Nothing
@@ -1568,7 +1554,7 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do
15681554
-- If mb_old_iface is nothing then checkOldIface will load it for us
15691555
-- given that the source is unmodified
15701556
(recomp_iface_reqd, mb_checked_iface)
1571-
<- liftIO $ checkOldIface sessionWithMsDynFlags ms _old_iface >>= \case
1557+
<- liftIO $ checkOldIface sessionWithMsDynFlags ms old_iface >>= \case
15721558
UpToDateItem x -> pure (UpToDate, Just x)
15731559
OutOfDateItem reason x -> pure (NeedsRecompile reason, x)
15741560

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module Development.IDE.Core.FileStore(
2525
) where
2626

2727
import Control.Concurrent.STM.Stats (STM, atomically)
28-
import Control.Concurrent.STM.TQueue (writeTQueue)
2928
import Control.Exception
3029
import Control.Lens ((^.))
3130
import Control.Monad.Extra

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ import qualified Data.Map as M
2525
import Data.Time.Clock.POSIX
2626
import Data.Typeable
2727
import Development.IDE.GHC.Compat hiding
28-
(HieFileResult,
29-
assert)
28+
(HieFileResult)
3029
import Development.IDE.GHC.Compat.Util
3130
import Development.IDE.GHC.CoreFile
3231
import Development.IDE.GHC.Util

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,10 @@ getModSummaryRule displayTHWarning recorder = do
924924
session' <- hscEnv <$> use_ GhcSession f
925925
modify_dflags <- getModifyDynFlags dynFlagsModifyGlobal
926926
let session = setNonHomeFCHook $ hscSetFlags (modify_dflags $ hsc_dflags session') session' -- TODO wz1000
927-
(modTime, mFileContent) <- getFileModTimeContents f
927+
(_modTime, mFileContent) <- getFileModTimeContents f
928928
let fp = fromNormalizedFilePath f
929929
modS <- liftIO $ runExceptT $
930-
getModSummaryFromImports session fp modTime (textToStringBuffer . Rope.toText <$> mFileContent)
930+
getModSummaryFromImports session fp (textToStringBuffer . Rope.toText <$> mFileContent)
931931
case modS of
932932
Right res -> do
933933
-- Check for Template Haskell

0 commit comments

Comments
 (0)