Skip to content

Commit e7b1ef0

Browse files
authored
Enable plugin tests in CI for GHC 9.4 (#3420)
* Run 9.4 tests for enabled plugins * Fix 9.4 tests * Fix splice plugin
1 parent 3b05bde commit e7b1ef0

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

.github/workflows/test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
name: Test hls-brittany-plugin
170170
run: cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-brittany-plugin --test-options="$TEST_OPTS"
171171

172-
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
172+
- if: matrix.test
173173
name: Test hls-refactor-plugin
174174
run: cabal test hls-refactor-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-refactor-plugin --test-options="$TEST_OPTS"
175175

@@ -193,7 +193,7 @@ jobs:
193193
name: Test hls-haddock-comments-plugin
194194
run: cabal test hls-haddock-comments-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-haddock-comments-plugin --test-options="$TEST_OPTS"
195195

196-
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
196+
- if: matrix.test
197197
name: Test hls-splice-plugin
198198
run: cabal test hls-splice-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-splice-plugin --test-options="$TEST_OPTS"
199199

@@ -205,7 +205,7 @@ jobs:
205205
name: Test hls-ormolu-plugin
206206
run: cabal test hls-ormolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-ormolu-plugin --test-options="$TEST_OPTS"
207207

208-
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
208+
- if: matrix.test
209209
name: Test hls-fourmolu-plugin
210210
run: cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-fourmolu-plugin --test-options="$TEST_OPTS"
211211

@@ -229,7 +229,7 @@ jobs:
229229
name: Test hls-rename-plugin test suite
230230
run: cabal test hls-rename-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-rename-plugin --test-options="$TEST_OPTS"
231231

232-
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
232+
- if: matrix.test
233233
name: Test hls-hlint-plugin test suite
234234
run: cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-hlint-plugin --test-options="$TEST_OPTS"
235235

@@ -249,15 +249,15 @@ jobs:
249249
name: Test hls-qualify-imported-names-plugin test suite
250250
run: cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-qualify-imported-names-plugin --test-options="$TEST_OPTS"
251251

252-
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
252+
- if: matrix.test
253253
name: Test hls-code-range-plugin test suite
254254
run: cabal test hls-code-range-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-code-range-plugin --test-options="$TEST_OPTS"
255255

256256
- if: matrix.test
257257
name: Test hls-change-type-signature test suite
258258
run: cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS"
259259

260-
- if: matrix.test && matrix.ghc != '9.4.2' && matrix.ghc != '9.4.3'
260+
- if: matrix.test
261261
name: Test hls-gadt-plugin test suit
262262
run: cabal test hls-gadt-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-gadt-plugin --test-options="$TEST_OPTS"
263263

plugins/hls-hlint-plugin/test/Main.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ suggestionsTests =
182182
doc <- openDoc "IgnoreAnnHlint.hs" "haskell"
183183
expectNoMoreDiagnostics 3 doc "hlint"
184184

185-
, knownBrokenForGhcVersions [GHC92] "apply-refact has different behavior on v0.10" $
185+
, knownBrokenForGhcVersions [GHC92, GHC94] "apply-refact has different behavior on v0.10" $
186186
testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
187187
testRefactor "Comments.hs" "Redundant bracket" expectedComments
188188

189-
, onlyRunForGhcVersions [GHC92] "only run test for apply-refact-0.10" $
189+
, onlyRunForGhcVersions [GHC92, GHC94] "only run test for apply-refact-0.10" $
190190
testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
191191
testRefactor "Comments.hs" "Redundant bracket" expectedComments'
192192

plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ annotate dflags needs_space ast = do
698698
let rendered = render dflags ast
699699
#if MIN_VERSION_ghc(9,4,0)
700700
expr' <- lift $ mapLeft (showSDoc dflags . ppr) $ parseAST dflags uniq rendered
701-
pure expr'
701+
pure $ setPrecedingLines expr' 0 (bool 0 1 needs_space)
702702
#elif MIN_VERSION_ghc(9,2,0)
703703
expr' <- lift $ mapLeft show $ parseAST dflags uniq rendered
704704
pure $ setPrecedingLines expr' 0 (bool 0 1 needs_space)

plugins/hls-refactor-plugin/test/Main.hs

+12-7
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ renameActionTests = testGroup "rename actions"
608608
doc <- createDoc "Testing.hs" "haskell" content
609609
_ <- waitForDiagnostics
610610
actionsOrCommands <- getCodeActions doc (Range (Position 3 12) (Position 3 20))
611-
[fixTypo] <- pure [action | InR action@CodeAction{ _title = actionTitle } <- actionsOrCommands, "monus" `T.isInfixOf` actionTitle ]
611+
[fixTypo] <- pure [action | InR action@CodeAction{ _title = actionTitle } <- actionsOrCommands, "monus" `T.isInfixOf` actionTitle , "Replace" `T.isInfixOf` actionTitle]
612612
executeCodeAction fixTypo
613613
contentAfterAction <- documentContents doc
614614
let expectedContentAfterAction = T.unlines
@@ -1669,8 +1669,10 @@ suggestImportTests = testGroup "suggest import actions"
16691669
, test True [] "f = empty" [] "import Control.Applicative (empty)"
16701670
, test True [] "f = empty" [] "import Control.Applicative"
16711671
, test True [] "f = (&)" [] "import Data.Function ((&))"
1672-
, test True [] "f = NE.nonEmpty" [] "import qualified Data.List.NonEmpty as NE"
1673-
, test True [] "f = Data.List.NonEmpty.nonEmpty" [] "import qualified Data.List.NonEmpty"
1672+
, ignoreForGHC94 "On GHC 9.4 the error message doesn't contain the qualified module name: https://gitlab.haskell.org/ghc/ghc/-/issues/20472"
1673+
$ test True [] "f = NE.nonEmpty" [] "import qualified Data.List.NonEmpty as NE"
1674+
, ignoreForGHC94 "On GHC 9.4 the error message doesn't contain the qualified module name: https://gitlab.haskell.org/ghc/ghc/-/issues/20472"
1675+
$ test True [] "f = Data.List.NonEmpty.nonEmpty" [] "import qualified Data.List.NonEmpty"
16741676
, test True [] "f :: Typeable a => a" ["f = undefined"] "import Data.Typeable (Typeable)"
16751677
, test True [] "f = pack" [] "import Data.Text (pack)"
16761678
, test True [] "f :: Text" ["f = undefined"] "import Data.Text (Text)"
@@ -1679,14 +1681,17 @@ suggestImportTests = testGroup "suggest import actions"
16791681
, test True [] "f = (.|.)" [] "import Data.Bits (Bits((.|.)))"
16801682
, test True [] "f = (.|.)" [] "import Data.Bits ((.|.))"
16811683
, test True [] "f :: a ~~ b" [] "import Data.Type.Equality ((~~))"
1682-
, test True
1684+
, ignoreForGHC94 "On GHC 9.4 the error message doesn't contain the qualified module name: https://gitlab.haskell.org/ghc/ghc/-/issues/20472"
1685+
$ test True
16831686
["qualified Data.Text as T"
16841687
] "f = T.putStrLn" [] "import qualified Data.Text.IO as T"
1685-
, test True
1688+
, ignoreForGHC94 "On GHC 9.4 the error message doesn't contain the qualified module name: https://gitlab.haskell.org/ghc/ghc/-/issues/20472"
1689+
$ test True
16861690
[ "qualified Data.Text as T"
16871691
, "qualified Data.Function as T"
16881692
] "f = T.putStrLn" [] "import qualified Data.Text.IO as T"
1689-
, test True
1693+
, ignoreForGHC94 "On GHC 9.4 the error message doesn't contain the qualified module name: https://gitlab.haskell.org/ghc/ghc/-/issues/20472"
1694+
$ test True
16901695
[ "qualified Data.Text as T"
16911696
, "qualified Data.Function as T"
16921697
, "qualified Data.Functor as T"
@@ -3784,7 +3789,7 @@ ignoreForGHC92 :: String -> TestTree -> TestTree
37843789
ignoreForGHC92 = ignoreFor (BrokenForGHC [GHC92])
37853790

37863791
ignoreForGHC94 :: String -> TestTree -> TestTree
3787-
ignoreForGHC94 = ignoreFor (BrokenForGHC [GHC94])
3792+
ignoreForGHC94 = knownIssueFor Broken (BrokenForGHC [GHC94])
37883793

37893794
data BrokenTarget =
37903795
BrokenSpecific OS [GhcVersion]

plugins/hls-refactor-plugin/test/data/hiding/hie.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ cradle:
22
direct:
33
arguments:
44
- -Wall
5-
- HideFunction.hs
65
- AVec.hs
76
- BVec.hs
87
- CVec.hs

0 commit comments

Comments
 (0)