@@ -2140,14 +2140,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2140
2140
[ (DsWarning , (6 , 8 ), " Defaulting the following constraint" )
2141
2141
, (DsWarning , (6 , 16 ), " Defaulting the following constraint" )
2142
2142
]
2143
- " Add type annotation ‘[Char] ’ to ‘\" debug\" ’"
2143
+ ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2144
2144
(T. unlines [ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2145
2145
, " {-# LANGUAGE OverloadedStrings #-}"
2146
2146
, " module A (f) where"
2147
2147
, " "
2148
2148
, " import Debug.Trace"
2149
2149
, " "
2150
- , " f = seq (\" debug\" :: [Char] ) traceShow \" debug\" "
2150
+ , " f = seq (\" debug\" :: " <> listOfChar <> " ) traceShow \" debug\" "
2151
2151
])
2152
2152
, testSession " add default type to satisfy two contraints" $
2153
2153
testFor
@@ -2160,14 +2160,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2160
2160
, " f a = traceShow \" debug\" a"
2161
2161
])
2162
2162
[ (DsWarning , (6 , 6 ), " Defaulting the following constraint" ) ]
2163
- " Add type annotation ‘[Char] ’ to ‘\" debug\" ’"
2163
+ ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2164
2164
(T. unlines [ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2165
2165
, " {-# LANGUAGE OverloadedStrings #-}"
2166
2166
, " module A (f) where"
2167
2167
, " "
2168
2168
, " import Debug.Trace"
2169
2169
, " "
2170
- , " f a = traceShow (\" debug\" :: [Char] ) a"
2170
+ , " f a = traceShow (\" debug\" :: " <> listOfChar <> " ) a"
2171
2171
])
2172
2172
, testSession " add default type to satisfy two contraints with duplicate literals" $
2173
2173
testFor
@@ -2180,14 +2180,14 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
2180
2180
, " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow \" debug\" ))"
2181
2181
])
2182
2182
[ (DsWarning , (6 , 54 ), " Defaulting the following constraint" ) ]
2183
- " Add type annotation ‘[Char] ’ to ‘\" debug\" ’"
2183
+ ( " Add type annotation ‘" <> listOfChar <> " ’ to ‘\" debug\" ’" )
2184
2184
(T. unlines [ " {-# OPTIONS_GHC -Wtype-defaults #-}"
2185
2185
, " {-# LANGUAGE OverloadedStrings #-}"
2186
2186
, " module A (f) where"
2187
2187
, " "
2188
2188
, " import Debug.Trace"
2189
2189
, " "
2190
- , " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow (\" debug\" :: [Char] )))"
2190
+ , " f = seq (\" debug\" :: [Char]) (seq (\" debug\" :: [Char]) (traceShow (\" debug\" :: " <> listOfChar <> " )))"
2191
2191
])
2192
2192
]
2193
2193
where
@@ -3172,7 +3172,7 @@ addSigLensesTests =
3172
3172
, (" pattern Some a = Just a" , " pattern Some :: a -> Maybe a" )
3173
3173
, (" qualifiedSigTest= C.realPart" , " qualifiedSigTest :: C.Complex a -> a" )
3174
3174
, (" head = 233" , " head :: Integer" )
3175
- , (" rank2Test (k :: forall a . a -> a) = (k 233 :: Int, k \" QAQ\" )" , " rank2Test :: (forall a. a -> a) -> (Int, [Char] )" )
3175
+ , (" rank2Test (k :: forall a . a -> a) = (k 233 :: Int, k \" QAQ\" )" , " rank2Test :: (forall a. a -> a) -> (Int, " <> listOfChar <> " )" )
3176
3176
, (" symbolKindTest = Proxy @\" qwq\" " , " symbolKindTest :: Proxy \" qwq\" " )
3177
3177
, (" promotedKindTest = Proxy @Nothing" , " promotedKindTest :: Proxy 'Nothing" )
3178
3178
, (" typeOperatorTest = Refl" , " typeOperatorTest :: a :~: a" )
@@ -4098,10 +4098,11 @@ highlightTests = testGroup "highlight"
4098
4098
highlights <- getHighlights doc (Position 4 15 )
4099
4099
liftIO $ highlights @?= List
4100
4100
-- Span is just the .. on 8.10, but Rec{..} before
4101
+ [
4101
4102
#if MIN_GHC_API_VERSION(8,10,0)
4102
- [ DocumentHighlight (R 4 8 4 10 ) (Just HkWrite )
4103
+ DocumentHighlight (R 4 8 4 10 ) (Just HkWrite )
4103
4104
#else
4104
- [ DocumentHighlight (R 4 4 4 11 ) (Just HkWrite )
4105
+ DocumentHighlight (R 4 4 4 11 ) (Just HkWrite )
4105
4106
#endif
4106
4107
, DocumentHighlight (R 4 14 4 20 ) (Just HkRead )
4107
4108
]
@@ -5420,3 +5421,11 @@ assertJust :: MonadIO m => String -> Maybe a -> m a
5420
5421
assertJust s = \ case
5421
5422
Nothing -> liftIO $ assertFailure s
5422
5423
Just x -> pure x
5424
+
5425
+ -- | Before ghc9, lists of Char is displayed as [Char], but with ghc9 and up, it's displayed as String
5426
+ listOfChar :: T. Text
5427
+ #if MIN_GHC_API_VERSION(9,0,1)
5428
+ listOfChar = " String"
5429
+ #else
5430
+ listOfChar = " [Char]"
5431
+ #endif
0 commit comments