Skip to content

Commit 41de40e

Browse files
authored
Remove more workarounds for GHCs < 9.2 (#4092) (#4098)
* Remove more workarounds for GHCs < 9.2 (#4092) * Delete removed module from cabal file * Remove unused package
1 parent 50923e5 commit 41de40e

29 files changed

+30
-221
lines changed

ghcide/ghcide.cabal

+3-5
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ library ghcide-test-utils
285285
visibility: public
286286
default-language: GHC2021
287287

288-
hs-source-dirs: test/src test/cabal
288+
hs-source-dirs: test/src test/cabal
289289
exposed-modules:
290290
Development.IDE.Test
291291
Development.IDE.Test.Runfiles
@@ -306,14 +306,13 @@ library ghcide-test-utils
306306
lsp-test ^>= 0.17,
307307
tasty-hunit >= 0.10,
308308
text,
309-
row-types,
310309

311310
default-extensions:
312311
LambdaCase
313312
OverloadedStrings
314313
RecordWildCards
315314
ViewPatterns
316-
315+
317316
test-suite ghcide-tests
318317
import: warnings
319318
type: exitcode-stdio-1.0
@@ -365,7 +364,7 @@ test-suite ghcide-tests
365364
if impl(ghc <9.3)
366365
build-depends: ghc-typelits-knownnat
367366

368-
hs-source-dirs: test/exe
367+
hs-source-dirs: test/exe
369368
ghc-options: -threaded -O0
370369

371370
main-is: Main.hs
@@ -392,7 +391,6 @@ test-suite ghcide-tests
392391
NonLspCommandLine
393392
OpenCloseTest
394393
OutlineTests
395-
PluginParsedResultTests
396394
PluginSimpleTests
397395
PositionMappingTests
398396
PreprocessorTests

ghcide/test/data/plugin-recorddot/RecordDot.hs

-6
This file was deleted.

ghcide/test/data/plugin-recorddot/cabal.project

-1
This file was deleted.

ghcide/test/data/plugin-recorddot/plugin.cabal

-9
This file was deleted.

ghcide/test/exe/CodeLensTests.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ addSigLensesTests =
8686
, ("rank2Test (k :: forall a . a -> a) = (k 233 :: Int, k \"QAQ\")", "rank2Test :: (forall a. a -> a) -> (Int, String)")
8787
, ("symbolKindTest = Proxy @\"qwq\"", "symbolKindTest :: Proxy \"qwq\"")
8888
, ("promotedKindTest = Proxy @Nothing", if ghcVersion >= GHC96 then "promotedKindTest :: Proxy Nothing" else "promotedKindTest :: Proxy 'Nothing")
89-
, ("typeOperatorTest = Refl", if ghcVersion >= GHC92 then "typeOperatorTest :: forall {k} {a :: k}. a :~: a" else "typeOperatorTest :: a :~: a")
89+
, ("typeOperatorTest = Refl", "typeOperatorTest :: forall {k} {a :: k}. a :~: a")
9090
, ("notInScopeTest = mkCharType", "notInScopeTest :: String -> Data.Data.DataType")
9191
, ("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")
9292
]

ghcide/test/exe/DependentFileTest.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module DependentFileTest (tests) where
77
import Control.Monad.IO.Class (liftIO)
88
import Data.Row
99
import qualified Data.Text as T
10-
import Development.IDE.GHC.Compat (GhcVersion (..), ghcVersion)
1110
import Development.IDE.Test (expectDiagnostics)
1211
import Development.IDE.Types.Location
1312
import Language.LSP.Protocol.Message
@@ -45,7 +44,7 @@ tests = testGroup "addDependentFile"
4544
_ <- createDoc "Foo.hs" "haskell" fooContent
4645
doc <- createDoc "Baz.hs" "haskell" bazContent
4746
expectDiagnostics
48-
[("Foo.hs", [(DiagnosticSeverity_Error, if ghcVersion >= GHC92 then (4,11) else (4, 6), "Couldn't match type")])]
47+
[("Foo.hs", [(DiagnosticSeverity_Error, (4,11), "Couldn't match type")])]
4948
-- Now modify the dependent file
5049
liftIO $ writeFile depFilePath "B"
5150
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams

ghcide/test/exe/FindDefinitionAndHoverTests.hs

+7-9
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,11 @@ tests = let
113113
typeDefinitionTests = [ tst (getTypeDefinitions, checkDefs) aaaL14 sourceFilePath (pure tcData) "Saturated data con"
114114
, tst (getTypeDefinitions, checkDefs) aL20 sourceFilePath (pure [ExpectNoDefinitions]) "Polymorphic variable"]
115115

116-
recordDotSyntaxTests
117-
| ghcVersion >= GHC92 =
118-
[ tst (getHover, checkHover) (Position 17 24) (T.unpack "RecordDotSyntax.hs") (pure [ExpectHoverText ["x :: MyRecord"]]) "hover over parent"
119-
, tst (getHover, checkHover) (Position 17 25) (T.unpack "RecordDotSyntax.hs") (pure [ExpectHoverText ["_ :: MyChild"]]) "hover over dot shows child"
120-
, tst (getHover, checkHover) (Position 17 26) (T.unpack "RecordDotSyntax.hs") (pure [ExpectHoverText ["_ :: MyChild"]]) "hover over child"
121-
]
122-
| otherwise = []
116+
recordDotSyntaxTests =
117+
[ tst (getHover, checkHover) (Position 17 24) (T.unpack "RecordDotSyntax.hs") (pure [ExpectHoverText ["x :: MyRecord"]]) "hover over parent"
118+
, tst (getHover, checkHover) (Position 17 25) (T.unpack "RecordDotSyntax.hs") (pure [ExpectHoverText ["_ :: MyChild"]]) "hover over dot shows child"
119+
, tst (getHover, checkHover) (Position 17 26) (T.unpack "RecordDotSyntax.hs") (pure [ExpectHoverText ["_ :: MyChild"]]) "hover over child"
120+
]
123121

124122
test runDef runHover look expect = testM runDef runHover look (return expect)
125123

@@ -157,8 +155,8 @@ tests = let
157155
spaceL37 = Position 41 24 ; space = [ExpectNoDefinitions, ExpectHoverText [":: Char"]]
158156
docL41 = Position 45 1 ; doc = [ExpectHoverText ["Recognizable docs: kpqz"]]
159157
; constr = [ExpectHoverText ["Monad m"]]
160-
eitL40 = Position 44 28 ; kindE = [ExpectHoverText [if ghcVersion >= GHC92 then ":: Type -> Type -> Type\n" else ":: * -> * -> *\n"]]
161-
intL40 = Position 44 34 ; kindI = [ExpectHoverText [if ghcVersion >= GHC92 then ":: Type\n" else ":: *\n"]]
158+
eitL40 = Position 44 28 ; kindE = [ExpectHoverText [":: Type -> Type -> Type\n"]]
159+
intL40 = Position 44 34 ; kindI = [ExpectHoverText [":: Type\n"]]
162160
tvrL40 = Position 44 37 ; kindV = [ExpectHoverText [":: * -> *\n"]]
163161
intL41 = Position 45 20 ; litI = [ExpectHoverText ["7518"]]
164162
chrL36 = Position 41 24 ; litC = [ExpectHoverText ["'f'"]]

ghcide/test/exe/Main.hs

-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import OutlineTests
5656
import HighlightTests
5757
import FindDefinitionAndHoverTests
5858
import PluginSimpleTests
59-
import PluginParsedResultTests
6059
import PreprocessorTests
6160
import THTests
6261
import SymlinkTests
@@ -103,7 +102,6 @@ main = do
103102
, HighlightTests.tests
104103
, FindDefinitionAndHoverTests.tests
105104
, PluginSimpleTests.tests
106-
, PluginParsedResultTests.tests
107105
, PreprocessorTests.tests
108106
, THTests.tests
109107
, SymlinkTests.tests

ghcide/test/exe/PluginParsedResultTests.hs

-16
This file was deleted.

ghcide/test/exe/TestUtils.hs

-3
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@ xfail = flip expectFailBecause
163163
ignoreInWindowsBecause :: String -> TestTree -> TestTree
164164
ignoreInWindowsBecause = ignoreFor (BrokenForOS Windows)
165165

166-
ignoreForGHC92Plus :: String -> TestTree -> TestTree
167-
ignoreForGHC92Plus = ignoreFor (BrokenForGHC [GHC92, GHC94, GHC96, GHC98])
168-
169166
knownBrokenForGhcVersions :: [GhcVersion] -> String -> TestTree -> TestTree
170167
knownBrokenForGhcVersions ghcVers = knownBrokenFor (BrokenForGHC ghcVers)
171168

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

+9-16
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,22 @@ tests =
7878
else
7979
"-- No instance for (Num String) arising from a use of `+'\n-- In the expression: \"a\" + \"bc\"\n-- In an equation for `res': res = \"a\" + \"bc\""
8080

81-
8281
evalInFile "T8.hs" "-- >>> \"" "-- lexical error in string/character literal at end of input"
8382
evalInFile "T8.hs" "-- >>> 3 `div` 0" "-- divide by zero" -- The default for marking exceptions is False
8483
, goldenWithEval "Applies file LANGUAGE extensions" "T9" "hs"
85-
, goldenWithEval' "Evaluate a type with :kind!" "T10" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
86-
, goldenWithEval' "Reports an error for an incorrect type with :kind!" "T11" "hs" (
87-
if ghcVersion >= GHC94 then "ghc94.expected"
88-
else if ghcVersion >= GHC92 then "ghc92.expected"
89-
else "expected"
90-
)
91-
, goldenWithEval' "Shows a kind with :kind" "T12" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
92-
, goldenWithEval' "Reports an error for an incorrect type with :kind" "T13" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
84+
, goldenWithEval "Evaluate a type with :kind!" "T10" "hs"
85+
, goldenWithEval' "Reports an error for an incorrect type with :kind!" "T11" "hs"
86+
(if ghcVersion >= GHC94 then "ghc94.expected" else "expected")
87+
, goldenWithEval "Shows a kind with :kind" "T12" "hs"
88+
, goldenWithEval "Reports an error for an incorrect type with :kind" "T13" "hs"
9389
, goldenWithEval' "Returns a fully-instantiated type for :type" "T14" "hs" (if ghcVersion >= GHC98 then "ghc98.expected" else "expected") -- See https://gitlab.haskell.org/ghc/ghc/-/issues/24069
9490
, knownBrokenForGhcVersions [GHC92, GHC94, GHC96, GHC98] "type +v does not work anymore with 9.2" $ goldenWithEval "Returns an uninstantiated type for :type +v, admitting multiple whitespaces around arguments" "T15" "hs"
9591
, goldenWithEval "Returns defaulted type for :type +d, admitting multiple whitespaces around arguments" "T16" "hs"
96-
, goldenWithEval' ":type reports an error when given with unknown +x option" "T17" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
92+
, goldenWithEval ":type reports an error when given with unknown +x option" "T17" "hs"
9793
, goldenWithEval "Reports an error when given with unknown command" "T18" "hs"
9894
, goldenWithEval "Returns defaulted type for :type +d reflecting the default declaration specified in the >>> prompt" "T19" "hs"
9995
, expectFailBecause "known issue - see a note in P.R. #361" $
100-
goldenWithEval' ":type +d reflects the `default' declaration of the module" "T20" "hs" (if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
96+
goldenWithEval ":type +d reflects the `default' declaration of the module" "T20" "hs"
10197
, testCase ":type handles a multilined result properly" $
10298
evalInFile "T21.hs" "-- >>> :type fun" $ T.unlines [
10399
"-- fun",
@@ -125,13 +121,10 @@ tests =
125121
, goldenWithEvalAndFs "Transitive local dependency" (FS.directProjectMulti ["TTransitive.hs", "TLocalImport.hs", "Util.hs"]) "TTransitive" "hs"
126122
-- , goldenWithEval "Local Modules can be imported in a test" "TLocalImportInTest" "hs"
127123
, goldenWithEval "Setting language option TupleSections" "TLanguageOptionsTupleSections" "hs"
128-
, goldenWithEval' ":set accepts ghci flags" "TFlags" "hs" (if ghcVersion >= GHC98 then "ghc98.expected" else if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
124+
, goldenWithEval' ":set accepts ghci flags" "TFlags" "hs" (if ghcVersion >= GHC98 then "ghc98.expected" else "expected")
129125
, testCase ":set -fprint-explicit-foralls works" $ do
130126
evalInFile "T8.hs" "-- >>> :t id" "-- id :: a -> a"
131-
evalInFile "T8.hs" "-- >>> :set -fprint-explicit-foralls\n-- >>> :t id"
132-
(if ghcVersion >= GHC92
133-
then "-- id :: forall a. a -> a"
134-
else "-- id :: forall {a}. a -> a")
127+
evalInFile "T8.hs" "-- >>> :set -fprint-explicit-foralls\n-- >>> :t id" "-- id :: forall a. a -> a"
135128
, goldenWithEval "The default language extensions for the eval plugin are the same as those for ghci" "TSameDefaultLanguageExtensionsAsGhci" "hs"
136129
, goldenWithEval "IO expressions are supported, stdout/stderr output is ignored" "TIO" "hs"
137130
, goldenWithEvalAndFs "Property checking" cabalProjectFS "TProperty" "hs"

plugins/hls-eval-plugin/test/testdata/T10.expected.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ type Dummy = 1 + 1
77
-- >>> type N = 1
88
-- >>> type M = 40
99
-- >>> :kind! N + M + 1
10-
-- N + M + 1 :: Nat
10+
-- N + M + 1 :: Natural
1111
-- = 42

plugins/hls-eval-plugin/test/testdata/T10.ghc92.expected

-11
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T10.ghc92.expected.hs

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module T11 where
22

33
-- >>> :kind! A
4-
-- Not in scope: type constructor or class ‘A’
4+
-- Not in scope: type constructor or class `A'

plugins/hls-eval-plugin/test/testdata/T12.expected.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ type Dummy = 1 + 1
77
-- >>> type N = 1
88
-- >>> type M = 40
99
-- >>> :kind N + M + 1
10-
-- N + M + 1 :: Nat
10+
-- N + M + 1 :: Natural

plugins/hls-eval-plugin/test/testdata/T12.ghc92.expected.hs

-10
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T12.ghc92_expected.hs

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module T13 where
22

33
-- >>> :kind A
4-
-- Not in scope: type constructor or class ‘A’
4+
-- Not in scope: type constructor or class `A'

plugins/hls-eval-plugin/test/testdata/T13.ghc92.expected.hs

-4
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T13.ghc92_expected.hs

-4
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T15.ghc92_expected.hs

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module T17 where
22

33
-- >>> :type +no 42
4-
-- parse error on input ‘+’
4+
-- parse error on input `+'

plugins/hls-eval-plugin/test/testdata/T17.ghc92.expected.hs

-4
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T17.ghc92_expected.hs

-4
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T20.ghc92.expected.hs

-7
This file was deleted.

plugins/hls-eval-plugin/test/testdata/T20.ghc92_expected.hs

-7
This file was deleted.

plugins/hls-eval-plugin/test/testdata/TFlags.expected.hs

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ module TFlags where
2020
Options apply only in the section where they are defined (unless they are in the setup section), so this will fail:
2121
2222
>>> class L a b c
23-
Too many parameters for class ‘L’
23+
Too many parameters for class `L'
2424
(Enable MultiParamTypeClasses to allow multi-parameter classes)
25+
In the class declaration for `L'
2526
-}
2627

2728

@@ -31,8 +32,9 @@ Options apply to all tests in the same section after their declaration.
3132
Not set yet:
3233
3334
>>> class D
34-
No parameters for class ‘D’
35+
No parameters for class `D'
3536
(Enable MultiParamTypeClasses to allow no-parameter classes)
37+
In the class declaration for `D'
3638
3739
Now it works:
3840

0 commit comments

Comments
 (0)