Skip to content

Commit fcf8a7f

Browse files
wz1000fendor
andauthored
GHC 9.12 support (#4527)
* GHC 9.12 support * cabal plugin * Fix hls-call-hierarchy-plugin tests * Fix hls-pragma-plugin tests * Add golden files specific to GHC 9.12.2 * Apply stylish-haskell formatting * Fix dodgy import in hls-semantic-token-plugin * Remove all deriving (Typeable). It is done by default * Fix view-pattern type sig warning * Run hls-eval-plugin test on Windows for GHC 9.12 only * Fix referenceImplementation for FuzzySearch tests --------- Co-authored-by: fendor <[email protected]> Co-authored-by: fendor <[email protected]>
1 parent 47835cd commit fcf8a7f

File tree

67 files changed

+1749
-214
lines changed

Some content is hidden

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

67 files changed

+1749
-214
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["9.10", "9.8", "9.6", "9.4"]
1+
["9.12", "9.10", "9.8", "9.6", "9.4"]

.github/workflows/test.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ jobs:
134134
HLS_WRAPPER_TEST_EXE: hls-wrapper
135135
run: cabal test wrapper-test
136136

137-
- if: matrix.test
137+
- if: matrix.test && matrix.ghc != '9.12'
138138
name: Test hls-refactor-plugin
139139
run: cabal test hls-refactor-plugin-tests || cabal test hls-refactor-plugin-tests
140140

141141
# TODO enable when it supports 9.10
142-
- if: matrix.test && matrix.ghc != '9.10'
142+
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
143143
name: Test hls-floskell-plugin
144144
run: cabal test hls-floskell-plugin-tests || cabal test hls-floskell-plugin-tests
145145

@@ -156,24 +156,24 @@ jobs:
156156
run: cabal test hls-eval-plugin-tests || cabal test hls-eval-plugin-tests
157157

158158
# TODO enable when it supports 9.10
159-
- if: matrix.test && matrix.ghc != '9.10'
159+
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
160160
name: Test hls-splice-plugin
161161
run: cabal test hls-splice-plugin-tests || cabal test hls-splice-plugin-tests
162162

163-
- if: matrix.test
163+
- if: matrix.test && matrix.ghc != '9.12'
164164
name: Test hls-stan-plugin
165165
run: cabal test hls-stan-plugin-tests || cabal test hls-stan-plugin-tests
166166

167167
# TODO enable when it supports 9.10
168-
- if: matrix.test && matrix.ghc != '9.10'
168+
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
169169
name: Test hls-stylish-haskell-plugin
170170
run: cabal test hls-stylish-haskell-plugin-tests || cabal test hls-stylish-haskell-plugin-tests
171171

172-
- if: matrix.test
172+
- if: matrix.test && matrix.ghc != '9.12'
173173
name: Test hls-ormolu-plugin
174174
run: cabal test hls-ormolu-plugin-tests || cabal test hls-ormolu-plugin-tests
175175

176-
- if: matrix.test
176+
- if: matrix.test && matrix.ghc != '9.12'
177177
name: Test hls-fourmolu-plugin
178178
run: cabal test hls-fourmolu-plugin-tests || cabal test hls-fourmolu-plugin-tests
179179

@@ -185,12 +185,12 @@ jobs:
185185
name: Test hls-call-hierarchy-plugin test suite
186186
run: cabal test hls-call-hierarchy-plugin-tests || cabal test hls-call-hierarchy-plugin-tests
187187

188-
- if: matrix.test && matrix.os != 'windows-latest'
188+
- if: matrix.test && matrix.os != 'windows-latest' && matrix.ghc != '9.12'
189189
name: Test hls-rename-plugin test suite
190190
run: cabal test hls-rename-plugin-tests || cabal test hls-rename-plugin-tests
191191

192192
# TODO enable when it supports 9.10
193-
- if: matrix.test && matrix.ghc != '9.10'
193+
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
194194
name: Test hls-hlint-plugin test suite
195195
run: cabal test hls-hlint-plugin-tests || cabal test hls-hlint-plugin-tests
196196

@@ -214,7 +214,7 @@ jobs:
214214
name: Test hls-change-type-signature test suite
215215
run: cabal test hls-change-type-signature-plugin-tests || cabal test hls-change-type-signature-plugin-tests
216216

217-
- if: matrix.test
217+
- if: matrix.test && matrix.ghc != '9.12'
218218
name: Test hls-gadt-plugin test suit
219219
run: cabal test hls-gadt-plugin-tests || cabal test hls-gadt-plugin-tests
220220

@@ -227,11 +227,11 @@ jobs:
227227
run: cabal test hls-explicit-record-fields-plugin-tests || cabal test hls-explicit-record-fields-plugin-tests
228228

229229
# versions need to be limited since the tests depend on cabal-fmt which only builds with ghc <9.10
230-
- if: matrix.test && matrix.ghc != '9.10'
230+
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
231231
name: Test hls-cabal-fmt-plugin test suite
232232
run: cabal test hls-cabal-fmt-plugin-tests --flag=isolateCabalfmtTests || cabal test hls-cabal-fmt-plugin-tests --flag=isolateCabalfmtTests
233233

234-
- if: matrix.test
234+
- if: matrix.test && matrix.ghc != '9.12'
235235
name: Test hls-cabal-gild-plugin test suite
236236
run: cabal test hls-cabal-gild-plugin-tests --flag=isolateCabalGildTests || cabal test hls-cabal-gild-plugin-tests --flag=isolateCabalGildTests
237237

@@ -240,7 +240,7 @@ jobs:
240240
run: cabal test hls-cabal-plugin-tests || cabal test hls-cabal-plugin-tests
241241

242242
# TODO enable when it supports 9.10
243-
- if: matrix.test && matrix.ghc != '9.10'
243+
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
244244
name: Test hls-retrie-plugin test suite
245245
run: cabal test hls-retrie-plugin-tests || cabal test hls-retrie-plugin-tests
246246

cabal.project

+12-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ packages:
88
./hls-test-utils
99

1010

11-
index-state: 2024-12-02T00:00:00Z
11+
index-state: 2025-03-20T00:00:00Z
1212

1313
tests: True
1414
test-show-details: direct
@@ -59,3 +59,14 @@ if impl(ghc >= 9.8.4) && impl(ghc < 9.8.5)
5959
ghc-lib-parser:filepath
6060
constraints:
6161
ghc-lib-parser==9.8.4.20241130
62+
63+
if impl(ghc >= 9.11)
64+
benchmarks: False
65+
allow-newer:
66+
hiedb:base,
67+
hiedb:ghc,
68+
hie-bios:ghc,
69+
ghc-trace-events:base,
70+
tasty-hspec:base,
71+
cabal-install-parsers:base,
72+
cabal-install-parsers:time,

ghcide-test/exe/ExceptionTests.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Control.Monad.Error.Class (MonadError (throwError))
88
import Control.Monad.IO.Class (liftIO)
99
import qualified Data.Aeson as A
1010
import Data.Default (Default (..))
11-
import Data.Text as T
11+
import qualified Data.Text as T
1212
import Development.IDE.Core.Shake (IdeState (..))
1313
import qualified Development.IDE.LSP.Notifications as Notifications
1414
import Development.IDE.Plugin.HLS (toResponseError)

ghcide-test/exe/FuzzySearch.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ referenceImplementation :: forall s t.
8888
(t -> s) ->
8989
-- | The original value, rendered string and score.
9090
Maybe (Fuzzy t s)
91-
referenceImplementation pat t pre post extract =
91+
referenceImplementation pat' t pre post extract =
9292
if null pat then Just (Fuzzy t result totalScore) else Nothing
9393
where
9494
null :: (T.TextualMonoid s) => s -> Bool
@@ -119,7 +119,7 @@ referenceImplementation pat t pre post extract =
119119
( 0,
120120
1, -- matching at the start gives a bonus (cur = 1)
121121
mempty,
122-
pat,
122+
pat',
123123
True
124124
)
125125
s

ghcide-test/exe/UnitTests.hs

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import qualified Progress
2929
import System.IO.Extra hiding (withTempDir)
3030
import System.Mem (performGC)
3131
import Test.Hls (IdeState, def,
32+
ignoreForGhcVersions,
33+
GhcVersion(..),
3234
runSessionWithServerInTmpDir,
3335
waitForProgressDone)
3436
import Test.Tasty

ghcide/ghcide.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ library
8787
, mtl
8888
, opentelemetry >=0.6.1
8989
, optparse-applicative
90+
, os-string
9091
, parallel
9192
, prettyprinter >=1.7
9293
, prettyprinter-ansi-terminal

ghcide/session-loader/Development/IDE/Session.hs

+10
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ import GHC.Types.Error (errMsgDiagnostic,
124124
singleMessage)
125125
import GHC.Unit.State
126126

127+
#if MIN_VERSION_ghc(9,13,0)
128+
import GHC.Driver.Make (checkHomeUnitsClosed)
129+
#endif
130+
127131
data Log
128132
= LogSettingInitialDynFlags
129133
| LogGetInitialGhcLibDirDefaultCradleFail !CradleError !FilePath !(Maybe FilePath) !(Cradle Void)
@@ -782,6 +786,11 @@ toFlagsMap TargetDetails{..} =
782786
setNameCache :: NameCache -> HscEnv -> HscEnv
783787
setNameCache nc hsc = hsc { hsc_NC = nc }
784788

789+
#if MIN_VERSION_ghc(9,13,0)
790+
-- Moved back to implementation in GHC.
791+
checkHomeUnitsClosed' :: UnitEnv -> OS.Set UnitId -> [DriverMessages]
792+
checkHomeUnitsClosed' ue _ = checkHomeUnitsClosed ue
793+
#elif MIN_VERSION_ghc(9,3,0)
785794
-- This function checks the important property that if both p and q are home units
786795
-- then any dependency of p, which transitively depends on q is also a home unit.
787796
-- GHC had an implementation of this function, but it was horribly inefficient
@@ -838,6 +847,7 @@ checkHomeUnitsClosed' ue home_id_set
838847
Just depends ->
839848
let todo'' = (depends OS.\\ done) `OS.union` todo'
840849
in DigraphNode uid uid (OS.toList depends) : go (OS.insert uid done) todo''
850+
#endif
841851

842852
-- | Create a mapping from FilePaths to HscEnvEqs
843853
-- This combines all the components we know about into

0 commit comments

Comments
 (0)