@@ -1095,8 +1095,8 @@ fillTypedHoleTests = let
1095
1095
1096
1096
addSigActionTests :: TestTree
1097
1097
addSigActionTests = let
1098
- header = " {-# OPTIONS_GHC -Wmissing-signatures #-}"
1099
- moduleH = " module Sigs where"
1098
+ header = " {-# OPTIONS_GHC -Wmissing-signatures -Wmissing-pattern-synonym-signatures #-}"
1099
+ moduleH = " {-# LANGUAGE PatternSynonyms #-} \n module Sigs where"
1100
1100
before def = T. unlines [header, moduleH, def]
1101
1101
after' def sig = T. unlines [header, moduleH, sig, def]
1102
1102
@@ -1112,19 +1112,20 @@ addSigActionTests = let
1112
1112
liftIO $ expectedCode @=? modifiedCode
1113
1113
in
1114
1114
testGroup " add signature"
1115
- [ " abc = True" >:: " abc :: Bool"
1116
- , " foo a b = a + b" >:: " foo :: Num a => a -> a -> a"
1117
- , " bar a b = show $ a + b" >:: " bar :: (Show a, Num a) => a -> a -> String"
1118
- , " (!!!) a b = a > b" >:: " (!!!) :: Ord a => a -> a -> Bool"
1119
- , " a >>>> b = a + b" >:: " (>>>>) :: Num a => a -> a -> a"
1120
- , " a `haha` b = a b" >:: " haha :: (t1 -> t2) -> t1 -> t2"
1115
+ [ " abc = True" >:: " abc :: Bool"
1116
+ , " foo a b = a + b" >:: " foo :: Num a => a -> a -> a"
1117
+ , " bar a b = show $ a + b" >:: " bar :: (Show a, Num a) => a -> a -> String"
1118
+ , " (!!!) a b = a > b" >:: " (!!!) :: Ord a => a -> a -> Bool"
1119
+ , " a >>>> b = a + b" >:: " (>>>>) :: Num a => a -> a -> a"
1120
+ , " a `haha` b = a b" >:: " haha :: (t1 -> t2) -> t1 -> t2"
1121
+ , " pattern Some a = Just a" >:: " pattern Some :: a -> Maybe a"
1121
1122
]
1122
1123
1123
1124
addSigLensesTests :: TestTree
1124
1125
addSigLensesTests = let
1125
- missing = " {-# OPTIONS_GHC -Wmissing-signatures -Wunused-matches #-}"
1126
+ missing = " {-# OPTIONS_GHC -Wmissing-signatures -Wmissing-pattern-synonym-signatures - Wunused-matches #-}"
1126
1127
notMissing = " {-# OPTIONS_GHC -Wunused-matches #-}"
1127
- moduleH = " module Sigs where"
1128
+ moduleH = " {-# LANGUAGE PatternSynonyms #-} \n module Sigs where"
1128
1129
other = T. unlines [" f :: Integer -> Integer" , " f x = 3" ]
1129
1130
before withMissing def
1130
1131
= T. unlines $ (if withMissing then (missing : ) else (notMissing : )) [moduleH, def, other]
@@ -1141,22 +1142,19 @@ addSigLensesTests = let
1141
1142
liftIO $ expectedCode @=? modifiedCode
1142
1143
in
1143
1144
testGroup " add signature"
1144
- [ testGroup " with warnings enabled"
1145
- [ sigSession True " abc = True" " abc :: Bool"
1146
- , sigSession True " foo a b = a + b" " foo :: Num a => a -> a -> a"
1147
- , sigSession True " bar a b = show $ a + b" " bar :: (Show a, Num a) => a -> a -> String"
1148
- , sigSession True " (!!!) a b = a > b" " (!!!) :: Ord a => a -> a -> Bool"
1149
- , sigSession True " a >>>> b = a + b" " (>>>>) :: Num a => a -> a -> a"
1150
- , sigSession True " a `haha` b = a b" " haha :: (t1 -> t2) -> t1 -> t2"
1151
- ]
1152
- , testGroup " with warnings disabled"
1153
- [ sigSession False " abc = True" " abc :: Bool"
1154
- , sigSession False " foo a b = a + b" " foo :: Num a => a -> a -> a"
1155
- , sigSession False " bar a b = show $ a + b" " bar :: (Show a, Num a) => a -> a -> String"
1156
- , sigSession False " (!!!) a b = a > b" " (!!!) :: Ord a => a -> a -> Bool"
1157
- , sigSession False " a >>>> b = a + b" " (>>>>) :: Num a => a -> a -> a"
1158
- , sigSession False " a `haha` b = a b" " haha :: (t1 -> t2) -> t1 -> t2"
1145
+ [ testGroup title
1146
+ [ sigSession enableWarnings " abc = True" " abc :: Bool"
1147
+ , sigSession enableWarnings " foo a b = a + b" " foo :: Num a => a -> a -> a"
1148
+ , sigSession enableWarnings " bar a b = show $ a + b" " bar :: (Show a, Num a) => a -> a -> String"
1149
+ , sigSession enableWarnings " (!!!) a b = a > b" " (!!!) :: Ord a => a -> a -> Bool"
1150
+ , sigSession enableWarnings " a >>>> b = a + b" " (>>>>) :: Num a => a -> a -> a"
1151
+ , sigSession enableWarnings " a `haha` b = a b" " haha :: (t1 -> t2) -> t1 -> t2"
1152
+ , sigSession enableWarnings " pattern Some a = Just a" " pattern Some :: a -> Maybe a"
1159
1153
]
1154
+ | (title, enableWarnings) <-
1155
+ [(" with warnings enabled" , True )
1156
+ ,(" with warnings disabled" , False )
1157
+ ]
1160
1158
]
1161
1159
1162
1160
findDefinitionAndHoverTests :: TestTree
0 commit comments