@@ -2190,14 +2190,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2190
2190
[ (DsWarning , (6 , 8 ), " Defaulting the following constraint" )
2191
2191
, (DsWarning , (6 , 16 ), " Defaulting the following constraint" )
2192
2192
]
2193
- " Add type annotation ‘[Char] ’ to ‘\" debug\" ’"
2193
+ ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2194
2194
(T. unlines [ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2195
2195
, " {-# LANGUAGE OverloadedStrings #-}"
2196
2196
, " module A (f) where"
2197
2197
, " "
2198
2198
, " import Debug.Trace"
2199
2199
, " "
2200
- , " f = seq (\" debug\" :: [Char] ) traceShow \" debug\" "
2200
+ , " f = seq (\" debug\" :: " <> listOfChar <> " ) traceShow \" debug\" "
2201
2201
])
2202
2202
, testSession " add default type to satisfy two contraints" $
2203
2203
testFor
@@ -2210,14 +2210,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2210
2210
, " f a = traceShow \" debug\" a"
2211
2211
])
2212
2212
[ (DsWarning , (6 , 6 ), " Defaulting the following constraint" ) ]
2213
- " Add type annotation ‘[Char] ’ to ‘\" debug\" ’"
2213
+ ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2214
2214
(T. unlines [ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2215
2215
, " {-# LANGUAGE OverloadedStrings #-}"
2216
2216
, " module A (f) where"
2217
2217
, " "
2218
2218
, " import Debug.Trace"
2219
2219
, " "
2220
- , " f a = traceShow (\" debug\" :: [Char] ) a"
2220
+ , " f a = traceShow (\" debug\" :: " <> listOfChar <> " ) a"
2221
2221
])
2222
2222
, testSession " add default type to satisfy two contraints with duplicate literals" $
2223
2223
testFor
@@ -2230,14 +2230,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2230
2230
, " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow \" debug\" ))"
2231
2231
])
2232
2232
[ (DsWarning , (6 , 54 ), " Defaulting the following constraint" ) ]
2233
- " Add type annotation ‘[Char] ’ to ‘\" debug\" ’"
2233
+ ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2234
2234
(T. unlines [ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2235
2235
, " {-# LANGUAGE OverloadedStrings #-}"
2236
2236
, " module A (f) where"
2237
2237
, " "
2238
2238
, " import Debug.Trace"
2239
2239
, " "
2240
- , " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow (\" debug\" :: [Char] )))"
2240
+ , " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow (\" debug\" :: " <> listOfChar <> " )))"
2241
2241
])
2242
2242
]
2243
2243
where
@@ -3222,7 +3222,7 @@ addSigLensesTests =
3222
3222
, (" pattern Some a = Just a" , " pattern Some :: a -> Maybe a" )
3223
3223
, (" qualifiedSigTest= C.realPart" , " qualifiedSigTest :: C.Complex a -> a" )
3224
3224
, (" head = 233" , " head :: Integer" )
3225
- , (" rank2Test (k :: forall a . a -> a) = (k 233 :: Int, k \" QAQ\" )" , " rank2Test :: (forall a. a -> a) -> (Int, [Char] )" )
3225
+ , (" rank2Test (k :: forall a . a -> a) = (k 233 :: Int, k \" QAQ\" )" , " rank2Test :: (forall a. a -> a) -> (Int, " <> listOfChar <> " )" )
3226
3226
, (" symbolKindTest = Proxy @\" qwq\" " , " symbolKindTest :: Proxy \" qwq\" " )
3227
3227
, (" promotedKindTest = Proxy @Nothing" , " promotedKindTest :: Proxy 'Nothing" )
3228
3228
, (" typeOperatorTest = Refl" , " typeOperatorTest :: a :~: a" )
@@ -4148,10 +4148,11 @@ highlightTests = testGroup "highlight"
4148
4148
highlights <- getHighlights doc (Position 4 15 )
4149
4149
liftIO $ highlights @?= List
4150
4150
-- Span is just the .. on 8.10, but Rec{..} before
4151
+ [
4151
4152
#if MIN_GHC_API_VERSION(8,10,0)
4152
- [ DocumentHighlight (R 4 8 4 10 ) (Just HkWrite )
4153
+ DocumentHighlight (R 4 8 4 10 ) (Just HkWrite )
4153
4154
#else
4154
- [ DocumentHighlight (R 4 4 4 11 ) (Just HkWrite )
4155
+ DocumentHighlight (R 4 4 4 11 ) (Just HkWrite )
4155
4156
#endif
4156
4157
, DocumentHighlight (R 4 14 4 20 ) (Just HkRead )
4157
4158
]
@@ -5506,3 +5507,11 @@ assertJust :: MonadIO m => String -> Maybe a -> m a
5506
5507
assertJust s = \ case
5507
5508
Nothing -> liftIO $ assertFailure s
5508
5509
Just x -> pure x
5510
+
5511
+ -- | Before ghc9, lists of Char is displayed as [Char], but with ghc9 and up, it's displayed as String
5512
+ listOfChar :: T. Text
5513
+ #if MIN_GHC_API_VERSION(9,0,1)
5514
+ listOfChar = " String"
5515
+ #else
5516
+ listOfChar = " [Char]"
5517
+ #endif
0 commit comments