Skip to content

Commit 4b452c9

Browse files
committed
Update all remaining diagnostics that could use an expected error code
1 parent 0cf77e5 commit 4b452c9

10 files changed

+33
-33
lines changed

ghcide/test/exe/CPPTests.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tests =
4242
," failed"
4343
,"#endif"
4444
]
45-
expectDiagnostics [("A.hs", [(DiagnosticSeverity_Error, (3, 2), "Variable not in scope: worked", Nothing)])]
45+
expectDiagnostics [("A.hs", [(DiagnosticSeverity_Error, (3, 2), "Variable not in scope: worked", Just "GHC-88464")])]
4646
]
4747
where
4848
expectError :: T.Text -> Cursor -> Session ()

ghcide/test/exe/CradleTests.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ simpleSubDirectoryTest =
112112
mainSource <- liftIO $ readFileUtf8 mainPath
113113
_mdoc <- createDoc mainPath "haskell" mainSource
114114
expectDiagnosticsWithTags
115-
[("a/src/Main.hs", [(DiagnosticSeverity_Warning,(2,0), "Top-level binding", Nothing, Nothing)]) -- So that we know P has been loaded
115+
[("a/src/Main.hs", [(DiagnosticSeverity_Warning,(2,0), "Top-level binding", Just "GHC-38417", Nothing)]) -- So that we know P has been loaded
116116
]
117117
expectNoMoreDiagnostics 0.5
118118

@@ -210,7 +210,7 @@ sessionDepsArePickedUp = testWithDummyPluginEmpty'
210210
"cradle: {direct: {arguments: []}}"
211211
-- Open without OverloadedStrings and expect an error.
212212
doc <- createDoc "Foo.hs" "haskell" fooContent
213-
expectDiagnostics [("Foo.hs", [(DiagnosticSeverity_Error, (3, 6), "Couldn't match type", Nothing)])]
213+
expectDiagnostics [("Foo.hs", [(DiagnosticSeverity_Error, (3, 6), "Couldn't match type", Just "GHC-83865")])]
214214

215215
-- Update hie.yaml to enable OverloadedStrings.
216216
liftIO $

ghcide/test/exe/DependentFileTest.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tests = testGroup "addDependentFile"
4646
_fooDoc <- createDoc "Foo.hs" "haskell" fooContent
4747
doc <- createDoc "Baz.hs" "haskell" bazContent
4848
expectDiagnostics
49-
[("Foo.hs", [(DiagnosticSeverity_Error, (4,11), "Couldn't match type", Nothing)])]
49+
[("Foo.hs", [(DiagnosticSeverity_Error, (4,11), "Couldn't match type", Just "GHC-83865")])]
5050
-- Now modify the dependent file
5151
liftIO $ writeFile depFilePath "B"
5252
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams

ghcide/test/exe/FindDefinitionAndHoverTests.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ tests = let
8888
, testGroup "hover" $ mapMaybe snd tests
8989
, testGroup "hover compile" [checkFileCompiles sourceFilePath $
9090
expectDiagnostics
91-
[ ( "GotoHover.hs", [(DiagnosticSeverity_Error, (62, 7), "Found hole: _", Nothing)])
92-
, ( "GotoHover.hs", [(DiagnosticSeverity_Error, (65, 8), "Found hole: _", Nothing)])
91+
[ ( "GotoHover.hs", [(DiagnosticSeverity_Error, (62, 7), "Found hole: _", Just "GHC-88464")])
92+
, ( "GotoHover.hs", [(DiagnosticSeverity_Error, (65, 8), "Found hole: _", Just "GHC-88464")])
9393
]]
9494
, testGroup "type-definition" typeDefinitionTests
9595
, testGroup "hover-record-dot-syntax" recordDotSyntaxTests ]

ghcide/test/exe/GarbageCollectionTests.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ tests = testGroup "garbage collection"
7272
changeDoc doc [TextDocumentContentChangeEvent . InR $ TextDocumentContentChangeWholeDocument edit]
7373
builds <- waitForTypecheck doc
7474
liftIO $ assertBool "it still builds" builds
75-
expectCurrentDiagnostics doc [(DiagnosticSeverity_Error, (2,4), "Couldn't match expected type", Nothing)]
75+
expectCurrentDiagnostics doc [(DiagnosticSeverity_Error, (2,4), "Couldn't match expected type", Just "GHC-83865")]
7676
]
7777
]
7878
where

ghcide/test/exe/IfaceTests.hs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ ifaceTHTest = testWithExtraFiles "iface-th-test" "TH" $ \dir -> do
5151
-- Check that the change propagates to C
5252
changeDoc cdoc [TextDocumentContentChangeEvent . InR $ TextDocumentContentChangeWholeDocument cSource]
5353
expectDiagnostics
54-
[("THC.hs", [(DiagnosticSeverity_Error, (4, 4), "Couldn't match expected type '()' with actual type 'Bool'", Nothing)])
55-
,("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Nothing)])]
54+
[("THC.hs", [(DiagnosticSeverity_Error, (4, 4), "Couldn't match expected type '()' with actual type 'Bool'", Just "GHC-83865")])
55+
,("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Just "GHC-38417")])]
5656
closeDoc cdoc
5757

5858
ifaceErrorTest :: TestTree
@@ -66,7 +66,7 @@ ifaceErrorTest = testWithExtraFiles "iface-error-test-1" "recomp" $ \dir -> do
6666

6767
bdoc <- createDoc bPath "haskell" bSource
6868
expectDiagnostics
69-
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Nothing)])] -- So what we know P has been loaded
69+
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Just "GHC-38417")])] -- So what we know P has been loaded
7070

7171
-- Change y from Int to B
7272
changeDoc bdoc [ TextDocumentContentChangeEvent . InR . TextDocumentContentChangeWholeDocument $
@@ -78,7 +78,7 @@ ifaceErrorTest = testWithExtraFiles "iface-error-test-1" "recomp" $ \dir -> do
7878

7979
-- Check that the error propagates to A
8080
expectDiagnostics
81-
[("A.hs", [(DiagnosticSeverity_Error, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'", Nothing)])]
81+
[("A.hs", [(DiagnosticSeverity_Error, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'", Just "GHC-83865")])]
8282

8383
-- Check that we wrote the interfaces for B when we saved
8484
hidir <- getInterfaceFilesDir bdoc
@@ -87,7 +87,7 @@ ifaceErrorTest = testWithExtraFiles "iface-error-test-1" "recomp" $ \dir -> do
8787

8888
pdoc <- openDoc pPath "haskell"
8989
expectDiagnostics
90-
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Nothing)])
90+
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Just "GHC-38417")])
9191
]
9292
changeDoc pdoc [TextDocumentContentChangeEvent . InR . TextDocumentContentChangeWholeDocument $ pSource <> "\nfoo = y :: Bool" ]
9393
-- Now in P we have
@@ -99,8 +99,8 @@ ifaceErrorTest = testWithExtraFiles "iface-error-test-1" "recomp" $ \dir -> do
9999
-- - The diagnostic for A has already been received. Ghcide does not repeat diagnostics
100100
-- - P is being typechecked with the last successful artifacts for A.
101101
expectDiagnostics
102-
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Nothing)])
103-
,("P.hs", [(DiagnosticSeverity_Warning,(6,0), "Top-level binding", Nothing)])
102+
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Just "GHC-38417")])
103+
,("P.hs", [(DiagnosticSeverity_Warning,(6,0), "Top-level binding", Just "GHC-38417")])
104104
]
105105
expectNoMoreDiagnostics 2
106106

@@ -115,7 +115,7 @@ ifaceErrorTest2 = testWithExtraFiles "iface-error-test-2" "recomp" $ \dir -> do
115115
bdoc <- createDoc bPath "haskell" bSource
116116
pdoc <- createDoc pPath "haskell" pSource
117117
expectDiagnostics
118-
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Nothing)])] -- So that we know P has been loaded
118+
[("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Just "GHC-38417")])] -- So that we know P has been loaded
119119

120120
-- Change y from Int to B
121121
changeDoc bdoc [TextDocumentContentChangeEvent . InR . TextDocumentContentChangeWholeDocument $
@@ -131,9 +131,9 @@ ifaceErrorTest2 = testWithExtraFiles "iface-error-test-2" "recomp" $ \dir -> do
131131
expectDiagnostics
132132
-- As in the other test, P is being typechecked with the last successful artifacts for A
133133
-- (ot thanks to -fdeferred-type-errors)
134-
[("A.hs", [(DiagnosticSeverity_Error, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'", Nothing)])
135-
,("P.hs", [(DiagnosticSeverity_Warning, (4, 0), "Top-level binding", Nothing)])
136-
,("P.hs", [(DiagnosticSeverity_Warning, (6, 0), "Top-level binding", Nothing)])
134+
[("A.hs", [(DiagnosticSeverity_Error, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'", Just "GHC-83865")])
135+
,("P.hs", [(DiagnosticSeverity_Warning, (4, 0), "Top-level binding", Just "GHC-38417")])
136+
,("P.hs", [(DiagnosticSeverity_Warning, (6, 0), "Top-level binding", Just "GHC-38417")])
137137
]
138138

139139
expectNoMoreDiagnostics 2
@@ -157,7 +157,7 @@ ifaceErrorTest3 = testWithExtraFiles "iface-error-test-3" "recomp" $ \dir -> do
157157
-- In this example the interface file for A should not exist (modulo the cache folder)
158158
-- Despite that P still type checks, as we can generate an interface file for A thanks to -fdeferred-type-errors
159159
expectDiagnostics
160-
[("A.hs", [(DiagnosticSeverity_Error, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'", Nothing)])
161-
,("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Nothing)])
160+
[("A.hs", [(DiagnosticSeverity_Error, (5, 4), "Couldn't match expected type 'Int' with actual type 'Bool'", Just "GHC-83865")])
161+
,("P.hs", [(DiagnosticSeverity_Warning,(4,0), "Top-level binding", Just "GHC-38417")])
162162
]
163163
expectNoMoreDiagnostics 2

ghcide/test/exe/PluginSimpleTests.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ tests =
4646

4747
expectDiagnostics
4848
[ ( "KnownNat.hs",
49-
[(DiagnosticSeverity_Error, (9, 15), "Variable not in scope: c", Nothing)]
49+
[(DiagnosticSeverity_Error, (9, 15), "Variable not in scope: c", Just "GHC-88464")]
5050
)
5151
]

ghcide/test/exe/PreprocessorTests.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ tests = testWithDummyPluginEmpty "preprocessor" $ do
2222
_ <- createDoc "Testing.hs" "haskell" content
2323
expectDiagnostics
2424
[ ( "Testing.hs",
25-
[(DiagnosticSeverity_Error, (2, 8), "Variable not in scope: z", Nothing)]
25+
[(DiagnosticSeverity_Error, (2, 8), "Variable not in scope: z", Just "GHC-88464")]
2626
)
2727
]

ghcide/test/exe/THTests.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tests =
4545
]
4646
_ <- createDoc "A.hs" "haskell" sourceA
4747
_ <- createDoc "B.hs" "haskell" sourceB
48-
expectDiagnostics [ ( "B.hs", [(DiagnosticSeverity_Error, (6, 29), "Variable not in scope: n", Nothing)] ) ]
48+
expectDiagnostics [ ( "B.hs", [(DiagnosticSeverity_Error, (6, 29), "Variable not in scope: n", Just "GHC-88464")] ) ]
4949
, testWithDummyPluginEmpty "newtype-closure" $ do
5050
let sourceA =
5151
T.unlines
@@ -93,7 +93,7 @@ tests =
9393
, "main = $a (putStrLn \"success!\")"]
9494
_ <- createDoc "A.hs" "haskell" sourceA
9595
_ <- createDoc "B.hs" "haskell" sourceB
96-
expectDiagnostics [ ( "B.hs", [(DiagnosticSeverity_Warning, (4, 0), "Top-level binding with no type signature: main :: IO ()", Nothing)] ) ]
96+
expectDiagnostics [ ( "B.hs", [(DiagnosticSeverity_Warning, (4, 0), "Top-level binding with no type signature: main :: IO ()", Just "GHC-38417")] ) ]
9797
, testCase "findsTHnewNameConstructor" $ runWithExtraFiles "THNewName" $ \dir -> do
9898

9999
-- This test defines a TH value with the meaning "data A = A" in A.hs
@@ -104,7 +104,7 @@ tests =
104104

105105
let cPath = dir </> "C.hs"
106106
_ <- openDoc cPath "haskell"
107-
expectDiagnostics [ ( cPath, [(DiagnosticSeverity_Warning, (3, 0), "Top-level binding with no type signature: a :: A", Nothing)] ) ]
107+
expectDiagnostics [ ( cPath, [(DiagnosticSeverity_Warning, (3, 0), "Top-level binding with no type signature: a :: A", Just "GHC-38417")] ) ]
108108
]
109109

110110

@@ -137,7 +137,7 @@ thReloadingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
137137
bdoc <- createDoc bPath "haskell" bSource
138138
cdoc <- createDoc cPath "haskell" cSource
139139

140-
expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Nothing)])]
140+
expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Just "GHC-38417")])]
141141

142142
-- Change th from () to Bool
143143
let aSource' = T.unlines $ init (T.lines aSource) ++ ["th_a = [d| a = False|]"]
@@ -147,9 +147,9 @@ thReloadingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
147147

148148
-- Check that the change propagates to C
149149
expectDiagnostics
150-
[("THC.hs", [(DiagnosticSeverity_Error, (4, 4), "Couldn't match expected type '()' with actual type 'Bool'", Nothing)])
151-
,("THC.hs", [(DiagnosticSeverity_Warning, (6,0), "Top-level binding", Nothing)])
152-
,("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level bindin", Nothing)])
150+
[("THC.hs", [(DiagnosticSeverity_Error, (4, 4), "Couldn't match expected type '()' with actual type 'Bool'", Just "GHC-83865")])
151+
,("THC.hs", [(DiagnosticSeverity_Warning, (6,0), "Top-level binding", Just "GHC-38417")])
152+
,("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level bindin", Just "GHC-38417")])
153153
]
154154

155155
closeDoc adoc
@@ -172,7 +172,7 @@ thLinkingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
172172
adoc <- createDoc aPath "haskell" aSource
173173
bdoc <- createDoc bPath "haskell" bSource
174174

175-
expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Nothing)])]
175+
expectDiagnostics [("THB.hs", [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Just "GHC-38417")])]
176176

177177
let aSource' = T.unlines $ init (init (T.lines aSource)) ++ ["th :: DecsQ", "th = [d| a = False|]"]
178178
changeDoc adoc [TextDocumentContentChangeEvent . InR $ TextDocumentContentChangeWholeDocument aSource']
@@ -182,7 +182,7 @@ thLinkingTest unboxed = testCase name $ runWithExtraFiles dir $ \dir -> do
182182
changeDoc bdoc [TextDocumentContentChangeEvent . InR $ TextDocumentContentChangeWholeDocument bSource']
183183
waitForDiagnostics
184184

185-
expectCurrentDiagnostics bdoc [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Nothing)]
185+
expectCurrentDiagnostics bdoc [(DiagnosticSeverity_Warning, (4,1), "Top-level binding", Just "GHC-38417")]
186186

187187
closeDoc adoc
188188
closeDoc bdoc

ghcide/test/exe/WatchedFileTests.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ tests = testGroup "watched files"
6060
,"a :: ()"
6161
,"a = b"
6262
]
63-
expectDiagnostics [("A.hs", [(DiagnosticSeverity_Error, (3, 4), "Couldn't match expected type '()' with actual type 'Bool'", Nothing)])]
63+
expectDiagnostics [("A.hs", [(DiagnosticSeverity_Error, (3, 4), "Couldn't match expected type '()' with actual type 'Bool'", Just "GHC-83865")])]
6464
-- modify B off editor
6565
liftIO $ writeFile (sessionDir </> "B.hs") $ unlines
6666
["module B where"
6767
,"b :: Int"
6868
,"b = 0"]
6969
sendNotification SMethod_WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
7070
[FileEvent (filePathToUri $ sessionDir </> "B.hs") FileChangeType_Changed ]
71-
expectDiagnostics [("A.hs", [(DiagnosticSeverity_Error, (3, 4), "Couldn't match expected type '()' with actual type 'Int'", Nothing)])]
71+
expectDiagnostics [("A.hs", [(DiagnosticSeverity_Error, (3, 4), "Couldn't match expected type '()' with actual type 'Int'", Just "GHC-83865")])]
7272
]
7373
]
7474

0 commit comments

Comments
 (0)