Skip to content

Commit 0e72151

Browse files
committed
Add GHC810 explicit version
1 parent c35cdda commit 0e72151

File tree

2 files changed

+54
-51
lines changed

2 files changed

+54
-51
lines changed

test/functional/FunctionalCodeAction.hs

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -282,31 +282,31 @@ typedHoleTests = testGroup "typed hole code actions" [
282282
_ <- waitForDiagnosticsSource "bios"
283283
cas <- map (\(CACodeAction x)-> x) <$> getAllCodeActions doc
284284

285-
suggestion <-
286-
case ghcVersion of
287-
GHC88 -> do
288-
liftIO $ map (^. L.title) cas `matchList`
289-
[ "Substitute hole (Int) with x ([Int])"
290-
, "Substitute hole (Int) with foo ([Int] -> Int Valid hole fits include)"
291-
, "Substitute hole (Int) with maxBound (forall a. Bounded a => a with maxBound @Int)"
292-
, "Substitute hole (Int) with minBound (forall a. Bounded a => a with minBound @Int)"
293-
] @? "Contains substitutions"
294-
return "x"
295-
GHC86 -> do
296-
liftIO $ map (^. L.title) cas `matchList`
297-
[ "Substitute hole (Int) with x ([Int])"
298-
, "Substitute hole (Int) with foo ([Int] -> Int Valid hole fits include)"
299-
, "Substitute hole (Int) with maxBound (forall a. Bounded a => a with maxBound @Int)"
300-
, "Substitute hole (Int) with minBound (forall a. Bounded a => a with minBound @Int)"
301-
] @? "Contains substitutions"
302-
return "x"
303-
GHC84 -> do
304-
liftIO $ map (^. L.title) cas `matchList`
305-
[ "Substitute hole (Int) with maxBound (forall a. Bounded a => a)"
306-
, "Substitute hole (Int) with minBound (forall a. Bounded a => a)"
307-
, "Substitute hole (Int) with undefined (forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a)"
308-
] @? "Contains substitutions"
309-
return "maxBound"
285+
let substitutions GHC810 = substitutions GHC88
286+
substitutions GHC88 =
287+
[ "Substitute hole (Int) with x ([Int])"
288+
, "Substitute hole (Int) with foo ([Int] -> Int Valid hole fits include)"
289+
, "Substitute hole (Int) with maxBound (forall a. Bounded a => a with maxBound @Int)"
290+
, "Substitute hole (Int) with minBound (forall a. Bounded a => a with minBound @Int)"
291+
]
292+
substitutions GHC86 =
293+
[ "Substitute hole (Int) with x ([Int])"
294+
, "Substitute hole (Int) with foo ([Int] -> Int Valid hole fits include)"
295+
, "Substitute hole (Int) with maxBound (forall a. Bounded a => a with maxBound @Int)"
296+
, "Substitute hole (Int) with minBound (forall a. Bounded a => a with minBound @Int)"
297+
]
298+
substitutions GHC84 =
299+
[ "Substitute hole (Int) with maxBound (forall a. Bounded a => a)"
300+
, "Substitute hole (Int) with minBound (forall a. Bounded a => a)"
301+
, "Substitute hole (Int) with undefined (forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a)"
302+
]
303+
304+
liftIO $ map (^. L.title) cas `matchList`
305+
substitutions ghcVersion @? "Contains substitutions"
306+
307+
let suggestion = case ghcVersion of
308+
GHC84 -> "maxBound"
309+
_ -> "x"
310310

311311
executeCodeAction $ head cas
312312

@@ -324,30 +324,30 @@ typedHoleTests = testGroup "typed hole code actions" [
324324
_ <- waitForDiagnosticsSource "bios"
325325
cas <- map fromAction <$> getAllCodeActions doc
326326

327-
suggestion <-
328-
case ghcVersion of
329-
GHC88 -> do
330-
liftIO $ map (^. L.title) cas `matchList`
331-
[ "Substitute hole (A) with stuff (A -> A)"
332-
, "Substitute hole (A) with x ([A])"
333-
, "Substitute hole (A) with foo2 ([A] -> A)"
334-
] @? "Contains substitutions"
335-
return "stuff"
336-
GHC86 -> do
337-
liftIO $ map (^. L.title) cas `matchList`
338-
[ "Substitute hole (A) with stuff (A -> A)"
339-
, "Substitute hole (A) with x ([A])"
340-
, "Substitute hole (A) with foo2 ([A] -> A)"
341-
] @? "Contains substituions"
342-
return "stuff"
343-
GHC84 -> do
344-
liftIO $ map (^. L.title) cas `matchList`
345-
[ "Substitute hole (A) with undefined (forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a)"
346-
, "Substitute hole (A) with stuff (A -> A)"
347-
, "Substitute hole (A) with x ([A])"
348-
, "Substitute hole (A) with foo2 ([A] -> A)"
349-
] @? "Contains substitutions"
350-
return "undefined"
327+
let substitutions GHC810 = substitutions GHC88
328+
substitutions GHC88 =
329+
[ "Substitute hole (A) with stuff (A -> A)"
330+
, "Substitute hole (A) with x ([A])"
331+
, "Substitute hole (A) with foo2 ([A] -> A)"
332+
]
333+
substitutions GHC86 =
334+
[ "Substitute hole (A) with stuff (A -> A)"
335+
, "Substitute hole (A) with x ([A])"
336+
, "Substitute hole (A) with foo2 ([A] -> A)"
337+
]
338+
substitutions GHC84 =
339+
[ "Substitute hole (A) with undefined (forall (a :: TYPE r). GHC.Stack.Types.HasCallStack => a)"
340+
, "Substitute hole (A) with stuff (A -> A)"
341+
, "Substitute hole (A) with x ([A])"
342+
, "Substitute hole (A) with foo2 ([A] -> A)"
343+
]
344+
345+
liftIO $ map (^. L.title) cas `matchList`
346+
substitutions ghcVersion @? "Contains substitutions"
347+
348+
let suggestion = case ghcVersion of
349+
GHC84 -> "undefined"
350+
_ -> "stuff"
351351

352352
executeCodeAction $ head cas
353353

test/utils/Test/Hls/Util.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,16 @@ files =
9696
]
9797

9898
data GhcVersion
99-
= GHC88
99+
= GHC810
100+
| GHC88
100101
| GHC86
101102
| GHC84
102103
deriving (Eq,Show)
103104

104105
ghcVersion :: GhcVersion
105-
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,8,0,0)))
106+
#if (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,10,0,0)))
107+
ghcVersion = GHC810
108+
#elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,8,0,0)))
106109
ghcVersion = GHC88
107110
#elif (defined(MIN_VERSION_GLASGOW_HASKELL) && (MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)))
108111
ghcVersion = GHC86

0 commit comments

Comments
 (0)