Skip to content

Commit 3009a45

Browse files
wz1000jhrceksoulomoonmichaelpjfendor
authored
Support for 9.10 (#4233)
* Support for 9.10 This includes supports for all plugins, other than formatters and hlint. We need ghc-exactprint and retrie release before merging this. * Remove indexed-traversable allow-newer * Fix couple of warnings * Fix flags job for hls-graph * foldl' exposed from Prelude since base 4.20 * Fix flags job for hls-plugin-api * Fix ghcide hover test * Fix flags job for hls-eval-plugin * unzip since 4.19 * More pedantic fixes * Don't CPP in tests, fix another test * Switch to ghc-exactprint and witherable from hackage * Fix all warnings in hls-refactor-plugin * Remove more no longer necessary allow newers * Fix all warnings in hls-gadp-plugin and hls-qualify-imported-names-plugin * Remove allow-newer for boring * Bump to lsp 2.6, remove more allow-newers * outline tests * disable simple plugin on 9.10 * Remove allow-newer for ghc-trace-events * fix appendConstraint * stylish * Remove commutative-semigroups and monoid-subclasses from allow-newer * Remove free from allow-newer * Fix 'type wilcard actions' tests * Remove hie-bios from allow-newer * Fix suggestNewDefinition tests * Revert "Fix suggestNewDefinition tests" This reverts commit 2f3300e. * Remove makeDeltaAst breaking tests unrelated to addArgument * Fix 79 code action tests * Fix 12 more tests * Remove co-log-core from allow-newer * Fix 21 more tests * Fix 8 import disambiguation tests * fix windows ghcide tests * Fix adding argument to function body * update retrie commit, progress in add argument tests * Fix few stylish-haskell parse errors * Fix remaining redundant constraint tests * Remove allow-newer for constraint-extras * Fix warnings after master merge * Fix most add argument tests except for one * Remove dependent-map from allow-newer * Try removing some allow-newers from lsp * Ormolu is updated, add links for other tool dependencies * Revert "Try removing some allow-newers from lsp" This reverts commit 6f60029. * Try this * Fix all gadt plugin and most class plugin tests, enable 2 tests for ghc 9.4+ * Undo spurious changes * Update eval plugin tests * Disable broken refactor plugin test for now * Fix warnings * Add source-repository-package to unblock floskell * Make call hierarchy plugin tests green * fix semantic tokens 9.10 * Fix remaining class plugin test * Update hls-change-type tests * Make class plugin more robust * Fix stylish parse errors, simplify CPP * Cleanups * Remove retrie dep from hls-refactor-plugin * More retrie fixes * Fix cabal-plugin-tests by respecting maxCompletions client cfg + a bit of CPP * Fixup ghcide-tests * disable retrie, splice and floskell plugins for 9.10 * Update tested-with + fix import warning * Fix stylish * Fix compilation with 9.2.8, fix stack jobs * Remove no longer relevant :type +v test * Disable tests of disabled plugins in CI * Try a better broken specifier? * Fix invalid CI config * Use getClientConfigAction instead of introducing new HandlerM action * Move CPPd imports to prevent stylish from evaluating CPP * Disable stan tests with ghc 9.10 in CI * attempt fixing exactprint <9.10 * Try enabling fourmolu now * Revert "Try enabling fourmolu now" This reverts commit 7142686. * Update code-range-plugin tests * Fix No newline at the end of file * Use more recent cabal-gild * Try setting some linker flags for macos * Ignore non-local variable completion test on windows for GHC 9.8 --------- Co-authored-by: Jan Hrček <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Michael Peyton Jones <[email protected]> Co-authored-by: Fendor <[email protected]>
1 parent c11f32b commit 3009a45

File tree

182 files changed

+1572
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+1572
-432
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[ "9.8", "9.6", "9.4" , "9.2" ]
1+
["9.10", "9.8", "9.6", "9.4" , "9.2" ]

.github/workflows/test.yml

+15-8
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
- uses: ./.github/actions/setup-build
9999
with:
100100
ghc: ${{ matrix.ghc }}
101-
os: ${{ runner.os }}
101+
os: ${{ runner.os }}
102102

103103
- name: Build
104104
run: cabal build all
@@ -141,7 +141,8 @@ jobs:
141141
name: Test hls-refactor-plugin
142142
run: cabal test hls-refactor-plugin-tests || cabal test hls-refactor-plugin-tests
143143

144-
- if: matrix.test
144+
# TODO enable when it supports 9.10
145+
- if: matrix.test && matrix.ghc != '9.10'
145146
name: Test hls-floskell-plugin
146147
run: cabal test hls-floskell-plugin-tests || cabal test hls-floskell-plugin-tests
147148

@@ -157,23 +158,27 @@ jobs:
157158
name: Test hls-eval-plugin
158159
run: cabal test hls-eval-plugin-tests || cabal test hls-eval-plugin-tests
159160

160-
- if: matrix.test
161+
# TODO enable when it supports 9.10
162+
- if: matrix.test && matrix.ghc != '9.10'
161163
name: Test hls-splice-plugin
162164
run: cabal test hls-splice-plugin-tests || cabal test hls-splice-plugin-tests
163165

164-
- if: matrix.test && matrix.ghc != '9.2'
166+
# TODO enable when it supports 9.10
167+
- if: matrix.test && matrix.ghc != '9.2' && matrix.ghc != '9.10'
165168
name: Test hls-stan-plugin
166169
run: cabal test hls-stan-plugin-tests || cabal test hls-stan-plugin-tests
167170

168-
- if: matrix.test
171+
# TODO enable when it supports 9.10
172+
- if: matrix.test && matrix.ghc != '9.10'
169173
name: Test hls-stylish-haskell-plugin
170174
run: cabal test hls-stylish-haskell-plugin-tests || cabal test hls-stylish-haskell-plugin-tests
171175

172176
- if: matrix.test
173177
name: Test hls-ormolu-plugin
174178
run: cabal test hls-ormolu-plugin-tests || cabal test hls-ormolu-plugin-tests
175179

176-
- if: matrix.test
180+
# TODO enable when it supports 9.10
181+
- if: matrix.test && matrix.ghc != '9.10'
177182
name: Test hls-fourmolu-plugin
178183
run: cabal test hls-fourmolu-plugin-tests || cabal test hls-fourmolu-plugin-tests
179184

@@ -189,7 +194,8 @@ jobs:
189194
name: Test hls-rename-plugin test suite
190195
run: cabal test hls-rename-plugin-tests || cabal test hls-rename-plugin-tests
191196

192-
- if: matrix.test
197+
# TODO enable when it supports 9.10
198+
- if: matrix.test && matrix.ghc != '9.10'
193199
name: Test hls-hlint-plugin test suite
194200
run: cabal test hls-hlint-plugin-tests || cabal test hls-hlint-plugin-tests
195201

@@ -238,7 +244,8 @@ jobs:
238244
name: Test hls-cabal-plugin test suite
239245
run: cabal test hls-cabal-plugin-tests || cabal test hls-cabal-plugin-tests
240246

241-
- if: matrix.test
247+
# TODO enable when it supports 9.10
248+
- if: matrix.test && matrix.ghc != '9.10'
242249
name: Test hls-retrie-plugin test suite
243250
run: cabal test hls-retrie-plugin-tests || cabal test hls-retrie-plugin-tests
244251

cabal.project

+28-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ packages:
77
./hls-plugin-api
88
./hls-test-utils
99

10-
index-state: 2024-06-07T00:00:00Z
10+
index-state: 2024-06-10T12:08:58Z
1111

1212
tests: True
1313
test-show-details: direct
1414

15-
benchmarks: True
15+
-- benchmarks: True
1616

1717
write-ghc-environment-files: never
1818

@@ -40,4 +40,29 @@ constraints:
4040
-- the flag '-fopen-simd', which blocked the release 2.2.0.0.
4141
-- We want to be able to benefit from the performance optimisations
4242
-- in the future, thus: TODO: remove this flag.
43-
bitvec -simd
43+
bitvec -simd,
44+
45+
46+
if impl(ghc >= 9.9)
47+
benchmarks: False
48+
constraints:
49+
lens >= 5.3.2,
50+
-- See
51+
-- https://github.com/haskell/stylish-haskell/issues/479
52+
-- https://github.com/fourmolu/fourmolu/issues/412
53+
-- https://github.com/ennocramer/floskell/pull/82
54+
-- https://github.com/ndmitchell/hlint/pull/1594
55+
haskell-language-server -stylishHaskell -fourmolu -hlint -retrie -splice -floskell,
56+
allow-newer:
57+
entropy:base,
58+
entropy:directory,
59+
entropy:filepath,
60+
entropy:process,
61+
haddock-library:base,
62+
haddock-library:containers,
63+
-- These can be removed when we get a new lsp release
64+
quickcheck-instances:base,
65+
quickcheck-instances:containers,
66+
uuid-types:template-haskell,
67+
else
68+
benchmarks: True

ghcide/ghcide.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ homepage:
1414
https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme
1515

1616
bug-reports: https://github.com/haskell/haskell-language-server/issues
17-
tested-with: GHC ==9.8.2 || ==9.6.5 || ==9.4.8 || ==9.2.8
17+
tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 || ==9.2.8
1818
extra-source-files:
1919
CHANGELOG.md
2020
README.md

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import Development.IDE.Core.Shake
7676
import Development.IDE.Core.Tracing (withTrace)
7777
import Development.IDE.GHC.Compat hiding (loadInterface,
7878
parseHeader, parseModule,
79-
tcRnModule, writeHieFile)
79+
tcRnModule, writeHieFile, assert)
8080
import qualified Development.IDE.GHC.Compat as Compat
8181
import qualified Development.IDE.GHC.Compat as GHC
8282
import qualified Development.IDE.GHC.Compat.Util as Util

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ progressReporting (Just lspEnv) optProgressStyle = do
129129
when (nextPct == prevPct) retry
130130
pure (todo, done, nextPct)
131131

132-
update (ProgressAmount (Just nextPct) (Just $ T.pack $ show done <> "/" <> show todo))
132+
_ <- update (ProgressAmount (Just nextPct) (Just $ T.pack $ show done <> "/" <> show todo))
133133
loop update nextPct
134134
updateStateForFile inProgress file = actionBracket (f succ) (const $ f pred) . const
135135
-- This functions are deliberately eta-expanded to avoid space leaks.

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module Development.IDE.Core.RuleTypes(
1616
) where
1717

1818
import Control.DeepSeq
19-
import Control.Exception (assert)
19+
import qualified Control.Exception as E
2020
import Control.Lens
2121
import Data.Aeson.Types (Value)
2222
import Data.Hashable
@@ -188,9 +188,9 @@ hiFileFingerPrint HiFileResult{..} = hirIfaceFp <> maybe "" snd hirCoreFp
188188

189189
mkHiFileResult :: ModSummary -> ModIface -> ModDetails -> ModuleEnv ByteString -> Maybe (CoreFile, ByteString) -> HiFileResult
190190
mkHiFileResult hirModSummary hirModIface hirModDetails hirRuntimeModules hirCoreFp =
191-
assert (case hirCoreFp of Just (CoreFile{cf_iface_hash}, _)
192-
-> getModuleHash hirModIface == cf_iface_hash
193-
_ -> True)
191+
E.assert (case hirCoreFp of
192+
Just (CoreFile{cf_iface_hash}, _) -> getModuleHash hirModIface == cf_iface_hash
193+
_ -> True)
194194
HiFileResult{..}
195195
where
196196
hirIfaceFp = fingerprintToBS . getModuleHash $ hirModIface -- will always be two bytes

ghcide/src/Development/IDE/GHC/CPP.hs

+7-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ import qualified GHC.Driver.Pipeline.Execute as Pipeline
3434
import qualified GHC.SysTools.Cpp as Pipeline
3535
#endif
3636

37+
#if MIN_VERSION_ghc(9,11,0)
38+
import qualified GHC.SysTools.Tasks as Pipeline
39+
#endif
40+
3741
addOptP :: String -> DynFlags -> DynFlags
3842
addOptP f = alterToolSettings $ \s -> s
3943
{ toolSettings_opt_P = f : toolSettings_opt_P s
@@ -52,7 +56,9 @@ doCpp env input_fn output_fn =
5256
#if MIN_VERSION_ghc(9,5,0)
5357
let cpp_opts = Pipeline.CppOpts
5458
{ cppLinePragmas = True
55-
#if MIN_VERSION_ghc(9,9,0)
59+
#if MIN_VERSION_ghc(9,11,0)
60+
, sourceCodePreprocessor = Pipeline.SCPHsCpp
61+
#elif MIN_VERSION_ghc(9,10,0)
5662
, useHsCpp = True
5763
#else
5864
, cppUseCc = False

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

+10-3
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,11 @@ myCoreToStg logger dflags ictxt
335335

336336
return (stg_binds2, denv, cost_centre_info)
337337

338-
338+
#if MIN_VERSION_ghc(9,9,0)
339+
reLocA :: (HasLoc (GenLocated a e), HasAnnotation b)
340+
=> GenLocated a e -> GenLocated b e
341+
reLocA = reLoc
342+
#endif
339343

340344
getDependentMods :: ModIface -> [ModuleName]
341345
#if MIN_VERSION_ghc(9,3,0)
@@ -515,13 +519,16 @@ data GhcVersion
515519
| GHC94
516520
| GHC96
517521
| GHC98
518-
deriving (Eq, Ord, Show)
522+
| GHC910
523+
deriving (Eq, Ord, Show, Enum)
519524

520525
ghcVersionStr :: String
521526
ghcVersionStr = VERSION_ghc
522527

523528
ghcVersion :: GhcVersion
524-
#if MIN_VERSION_GLASGOW_HASKELL(9,8,0,0)
529+
#if MIN_VERSION_GLASGOW_HASKELL(9,10,0,0)
530+
ghcVersion = GHC910
531+
#elif MIN_VERSION_GLASGOW_HASKELL(9,8,0,0)
525532
ghcVersion = GHC98
526533
#elif MIN_VERSION_GLASGOW_HASKELL(9,6,0,0)
527534
ghcVersion = GHC96

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

+33-4
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ module Development.IDE.GHC.Compat.Core (
197197
pattern RealSrcLoc,
198198
SrcLoc.SrcLoc(SrcLoc.UnhelpfulLoc),
199199
BufSpan,
200+
#if !MIN_VERSION_ghc(9,9,0)
200201
GHC.SrcAnn,
202+
#endif
201203
SrcLoc.leftmost_smallest,
202204
SrcLoc.containsSpan,
203205
SrcLoc.mkGeneralSrcSpan,
@@ -494,8 +496,11 @@ import Data.Foldable (toList)
494496
import GHC.Core.Multiplicity (scaledThing)
495497
import GHC.Data.Bag
496498
import GHC.Driver.Env
497-
import GHC.Hs (HsModule (..), SrcSpanAnn')
498-
import GHC.Hs.Decls hiding (FunDep)
499+
import GHC.Hs (HsModule (..))
500+
#if !MIN_VERSION_ghc(9,9,0)
501+
import GHC.Hs (SrcSpanAnn')
502+
#endif
503+
import GHC.Hs.Decls hiding (FunDep)
499504
import GHC.Hs.Doc
500505
import GHC.Hs.Expr
501506
import GHC.Hs.Extension
@@ -651,20 +656,36 @@ instance HasSrcSpan SrcSpan where
651656
instance HasSrcSpan (SrcLoc.GenLocated SrcSpan a) where
652657
getLoc = GHC.getLoc
653658

659+
#if MIN_VERSION_ghc(9,9,0)
660+
instance HasSrcSpan (EpAnn a) where
661+
getLoc = GHC.getHasLoc
662+
#endif
663+
664+
#if MIN_VERSION_ghc(9,9,0)
665+
instance HasSrcSpan (SrcLoc.GenLocated (EpAnn ann) a) where
666+
getLoc (L l _) = getLoc l
667+
#else
654668
instance HasSrcSpan (SrcSpanAnn' ann) where
655669
getLoc = GHC.locA
656670
instance HasSrcSpan (SrcLoc.GenLocated (SrcSpanAnn' ann) a) where
657671
getLoc (L l _) = l
672+
#endif
658673

659674
pattern L :: HasSrcSpan a => SrcSpan -> e -> SrcLoc.GenLocated a e
660675
pattern L l a <- GHC.L (getLoc -> l) a
661676
{-# COMPLETE L #-}
662677

663678
-- This is from the old api, but it still simplifies
664679
pattern ConPatIn :: SrcLoc.Located (ConLikeP GhcPs) -> HsConPatDetails GhcPs -> Pat GhcPs
680+
#if MIN_VERSION_ghc(9,9,0)
681+
pattern ConPatIn con args <- ConPat _ (L _ (SrcLoc.noLoc -> con)) args
682+
where
683+
ConPatIn con args = ConPat GHC.noAnn (GHC.noLocA $ SrcLoc.unLoc con) args
684+
#else
665685
pattern ConPatIn con args <- ConPat EpAnnNotUsed (L _ (SrcLoc.noLoc -> con)) args
666686
where
667687
ConPatIn con args = ConPat EpAnnNotUsed (GHC.noLocA $ SrcLoc.unLoc con) args
688+
#endif
668689

669690
conPatDetails :: Pat p -> Maybe (HsConPatDetails p)
670691
conPatDetails (ConPat _ _ args) = Just args
@@ -680,8 +701,16 @@ initObjLinker env =
680701
GHCi.initObjLinker (GHCi.hscInterp env)
681702

682703
loadDLL :: HscEnv -> String -> IO (Maybe String)
683-
loadDLL env =
684-
GHCi.loadDLL (GHCi.hscInterp env)
704+
loadDLL env str = do
705+
res <- GHCi.loadDLL (GHCi.hscInterp env) str
706+
#if MIN_VERSION_ghc(9,11,0)
707+
pure $
708+
case res of
709+
Left err_msg -> Just err_msg
710+
Right _ -> Nothing
711+
#else
712+
pure res
713+
#endif
685714

686715
unload :: HscEnv -> [Linkable] -> IO ()
687716
unload hsc_env linkables =

ghcide/src/Development/IDE/GHC/Orphans.hs

+7-2
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,19 @@ instance NFData ModSummary where
109109
instance Ord FastString where
110110
compare a b = if a == b then EQ else compare (fs_sbs a) (fs_sbs b)
111111

112+
113+
#if MIN_VERSION_ghc(9,9,0)
114+
instance NFData (EpAnn a) where
115+
rnf = rwhnf
116+
#else
112117
instance NFData (SrcSpanAnn' a) where
113118
rnf = rwhnf
119+
deriving instance Functor SrcSpanAnn'
120+
#endif
114121

115122
instance Bifunctor GenLocated where
116123
bimap f g (L l x) = L (f l) (g x)
117124

118-
deriving instance Functor SrcSpanAnn'
119-
120125
instance NFData ParsedModule where
121126
rnf = rwhnf
122127

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ hsConDeclsBinders cons
271271

272272
get_flds_gadt :: HsConDeclGADTDetails GhcPs
273273
-> [LFieldOcc GhcPs]
274-
#if MIN_VERSION_ghc(9,3,0)
274+
#if MIN_VERSION_ghc(9,9,0)
275+
get_flds_gadt (RecConGADT _ flds) = get_flds (reLoc flds)
276+
#elif MIN_VERSION_ghc(9,3,0)
275277
get_flds_gadt (RecConGADT flds _) = get_flds (reLoc flds)
276278
#else
277279
get_flds_gadt (RecConGADT flds) = get_flds (reLoc flds)

ghcide/test/cabal/Development/IDE/Test/Runfiles.hs

-9
This file was deleted.

ghcide/test/exe/BootTests.hs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Language.LSP.Protocol.Types hiding
1717
mkRange)
1818
import Language.LSP.Test
1919
import System.FilePath ((</>))
20-
import Test.Hls.FileSystem (toAbsFp)
2120
import Test.Tasty
2221
import Test.Tasty.HUnit
2322

ghcide/test/exe/ClientSettingsTests.hs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{-# LANGUAGE GADTs #-}
22
module ClientSettingsTests (tests) where
33

4-
import Config (lspTestCaps, testWithConfig,
5-
testWithDummyPluginEmpty)
4+
import Config (testWithDummyPluginEmpty)
65
import Control.Applicative.Combinators
76
import Control.Monad
87
import Data.Aeson (toJSON)
@@ -16,8 +15,7 @@ import Language.LSP.Protocol.Types hiding
1615
SemanticTokensEdit (..),
1716
mkRange)
1817
import Language.LSP.Test
19-
import Test.Hls (testConfigCaps,
20-
waitForProgressDone)
18+
import Test.Hls (waitForProgressDone)
2119
import Test.Tasty
2220

2321
tests :: TestTree

ghcide/test/exe/CodeLensTests.hs

+5-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ addSigLensesTests =
8888
, ("symbolKindTest = Proxy @\"qwq\"", "symbolKindTest :: Proxy \"qwq\"")
8989
, ("promotedKindTest = Proxy @Nothing", if ghcVersion >= GHC96 then "promotedKindTest :: Proxy Nothing" else "promotedKindTest :: Proxy 'Nothing")
9090
, ("typeOperatorTest = Refl", "typeOperatorTest :: forall {k} {a :: k}. a :~: a")
91-
, ("notInScopeTest = mkCharType", "notInScopeTest :: String -> Data.Data.DataType")
91+
, ("notInScopeTest = mkCharType"
92+
, if ghcVersion < GHC910
93+
then "notInScopeTest :: String -> Data.Data.DataType"
94+
else "notInScopeTest :: String -> GHC.Internal.Data.Data.DataType"
95+
)
9296
, ("aVeryLongSignature a b c d e f g h i j k l m n = a && b && c && d && e && f && g && h && i && j && k && l && m && n", "aVeryLongSignature :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool")
9397
]
9498
in testGroup

0 commit comments

Comments
 (0)