@@ -48,7 +48,7 @@ tests = testGroup "diagnostics"
48
48
[ testWithDummyPluginEmpty " fix syntax error" $ do
49
49
let content = T. unlines [ " module Testing wher" ]
50
50
doc <- createDoc " Testing.hs" " haskell" content
51
- expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " parse error" , Nothing )])]
51
+ expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " parse error" , Just " GHC-58481 " )])]
52
52
let change = TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
53
53
{ _range = Range (Position 0 15 ) (Position 0 19 )
54
54
, _rangeLength = Nothing
@@ -67,18 +67,18 @@ tests = testGroup "diagnostics"
67
67
, _text = " wher"
68
68
}
69
69
changeDoc doc [change]
70
- expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " parse error" , Nothing )])]
70
+ expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " parse error" , Just " GHC-58481 " )])]
71
71
, testWithDummyPluginEmpty " update syntax error" $ do
72
72
let content = T. unlines [ " module Testing(missing) where" ]
73
73
doc <- createDoc " Testing.hs" " haskell" content
74
- expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " Not in scope: 'missing'" , Nothing )])]
74
+ expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " Not in scope: 'missing'" , Just " GHC-76037 " )])]
75
75
let change = TextDocumentContentChangeEvent $ InL TextDocumentContentChangePartial
76
76
{ _range = Range (Position 0 15 ) (Position 0 16 )
77
77
, _rangeLength = Nothing
78
78
, _text = " l"
79
79
}
80
80
changeDoc doc [change]
81
- expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " Not in scope: 'lissing'" , Nothing )])]
81
+ expectDiagnostics [(" Testing.hs" , [(DiagnosticSeverity_Error , (0 , 15 ), " Not in scope: 'lissing'" , Just " GHC-76037 " )])]
82
82
, testWithDummyPluginEmpty " variable not in scope" $ do
83
83
let content = T. unlines
84
84
[ " module Testing where"
@@ -90,8 +90,8 @@ tests = testGroup "diagnostics"
90
90
_ <- createDoc " Testing.hs" " haskell" content
91
91
expectDiagnostics
92
92
[ ( " Testing.hs"
93
- , [ (DiagnosticSeverity_Error , (2 , 15 ), " Variable not in scope: ab" , Nothing )
94
- , (DiagnosticSeverity_Error , (4 , 11 ), " Variable not in scope: cd" , Nothing )
93
+ , [ (DiagnosticSeverity_Error , (2 , 15 ), " Variable not in scope: ab" , Just " GHC-88464 " )
94
+ , (DiagnosticSeverity_Error , (4 , 11 ), " Variable not in scope: cd" , Just " GHC-88464 " )
95
95
]
96
96
)
97
97
]
@@ -116,7 +116,7 @@ tests = testGroup "diagnostics"
116
116
_ <- createDoc " Testing.hs" " haskell" content
117
117
expectDiagnostics
118
118
[ ( " Testing.hs"
119
- , [(DiagnosticSeverity_Error , (2 , 8 ), " Found hole: _ :: Int -> String" , Nothing )]
119
+ , [(DiagnosticSeverity_Error , (2 , 8 ), " Found hole: _ :: Int -> String" , Just " GHC-88464 " )]
120
120
)
121
121
]
122
122
@@ -131,17 +131,17 @@ tests = testGroup "diagnostics"
131
131
, " b :: Float"
132
132
, " b = True" ]
133
133
bMessage = " Couldn't match expected type 'Float' with actual type 'Bool'"
134
- expectedDs aMessage =
135
- [ (" A.hs" , [(DiagnosticSeverity_Error , (2 ,4 ), aMessage, Nothing )])
136
- , (" B.hs" , [(DiagnosticSeverity_Error , (3 ,4 ), bMessage, Nothing )])]
137
- deferralTest title binding msg = testWithDummyPluginEmpty title $ do
134
+ expectedDs aMessage aCode =
135
+ [ (" A.hs" , [(DiagnosticSeverity_Error , (2 ,4 ), aMessage, aCode )])
136
+ , (" B.hs" , [(DiagnosticSeverity_Error , (3 ,4 ), bMessage, Just " GHC-83865 " )])]
137
+ deferralTest title binding msg code = testWithDummyPluginEmpty title $ do
138
138
_ <- createDoc " A.hs" " haskell" $ sourceA binding
139
139
_ <- createDoc " B.hs" " haskell" sourceB
140
- expectDiagnostics $ expectedDs msg
140
+ expectDiagnostics $ expectedDs msg code
141
141
in
142
- [ deferralTest " type error" " True" " Couldn't match expected type"
143
- , deferralTest " typed hole" " _" " Found hole"
144
- , deferralTest " out of scope var" " unbound" " Variable not in scope"
142
+ [ deferralTest " type error" " True" " Couldn't match expected type" ( Just " GHC-83865 " )
143
+ , deferralTest " typed hole" " _" " Found hole" ( Just " GHC-88464 " )
144
+ , deferralTest " out of scope var" " unbound" " Variable not in scope" ( Just " GHC-88464 " )
145
145
]
146
146
147
147
, testWithDummyPluginEmpty " remove required module" $ do
@@ -243,7 +243,7 @@ tests = testGroup "diagnostics"
243
243
_ <- createDoc " ModuleA.hs" " haskell" contentA
244
244
_ <- createDoc " ModuleB.hs" " haskell" contentB
245
245
_ <- createDoc " ModuleB.hs-boot" " haskell" contentBboot
246
- expectDiagnostics [(" ModuleB.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Nothing )])]
246
+ expectDiagnostics [(" ModuleB.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Just " GHC-38417 " )])]
247
247
, testWithDummyPlugin " bidirectional module dependency with hs-boot"
248
248
(mkIdeTestFs [directCradle [" ModuleA" , " ModuleB" ]])
249
249
$ do
@@ -268,7 +268,7 @@ tests = testGroup "diagnostics"
268
268
_ <- createDoc " ModuleA.hs-boot" " haskell" contentAboot
269
269
_ <- createDoc " ModuleB.hs" " haskell" contentB
270
270
_ <- createDoc " ModuleB.hs-boot" " haskell" contentBboot
271
- expectDiagnostics [(" ModuleB.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Nothing )])]
271
+ expectDiagnostics [(" ModuleB.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Just " GHC-38417 " )])]
272
272
, testWithDummyPluginEmpty " correct reference used with hs-boot" $ do
273
273
let contentB = T. unlines
274
274
[ " module ModuleB where"
@@ -294,7 +294,7 @@ tests = testGroup "diagnostics"
294
294
_ <- createDoc " ModuleA.hs" " haskell" contentA
295
295
_ <- createDoc " ModuleA.hs-boot" " haskell" contentAboot
296
296
_ <- createDoc " ModuleC.hs" " haskell" contentC
297
- expectDiagnostics [(" ModuleC.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Nothing )])]
297
+ expectDiagnostics [(" ModuleC.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Just " GHC-38417 " )])]
298
298
, testWithDummyPluginEmpty " redundant import" $ do
299
299
let contentA = T. unlines [" module ModuleA where" ]
300
300
let contentB = T. unlines
@@ -320,7 +320,7 @@ tests = testGroup "diagnostics"
320
320
]
321
321
_ <- createDoc " ModuleA.hs" " haskell" contentA
322
322
_ <- createDoc " ModuleB.hs" " haskell" contentB
323
- expectDiagnostics [(" ModuleB.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Nothing )])]
323
+ expectDiagnostics [(" ModuleB.hs" , [(DiagnosticSeverity_Warning , (3 ,0 ), " Top-level binding" , Just " GHC-38417 " )])]
324
324
, testWithDummyPluginEmpty " package imports" $ do
325
325
let thisDataListContent = T. unlines
326
326
[ " module Data.List where"
@@ -348,14 +348,14 @@ tests = testGroup "diagnostics"
348
348
else if ghcVersion >= GHC94 then
349
349
" Variable not in scope: map" -- See https://gitlab.haskell.org/ghc/ghc/-/issues/22130
350
350
else
351
- " Not in scope: \8216ThisList.map\8217" , Nothing )
351
+ " Not in scope: \8216ThisList.map\8217" , Just " GHC-88464 " )
352
352
,(DiagnosticSeverity_Error , (7 , 9 ),
353
353
if ghcVersion >= GHC96 then
354
354
" Variable not in scope: BaseList.x"
355
355
else if ghcVersion >= GHC94 then
356
356
" Variable not in scope: x" -- See https://gitlab.haskell.org/ghc/ghc/-/issues/22130
357
357
else
358
- " Not in scope: \8216BaseList.x\8217" , Nothing )
358
+ " Not in scope: \8216BaseList.x\8217" , Just " GHC-88464 " )
359
359
]
360
360
)
361
361
]
@@ -373,7 +373,7 @@ tests = testGroup "diagnostics"
373
373
-- where appropriate. The warning should use an unqualified name 'Ord', not
374
374
-- something like 'GHC.Classes.Ord'. The choice of redundant-constraints to
375
375
-- test this is fairly arbitrary.
376
- , [(DiagnosticSeverity_Warning , (2 , if ghcVersion >= GHC94 then 7 else 0 ), " Redundant constraint: Ord a" , Nothing )
376
+ , [(DiagnosticSeverity_Warning , (2 , if ghcVersion >= GHC94 then 7 else 0 ), " Redundant constraint: Ord a" , Just " GHC-30606 " )
377
377
]
378
378
)
379
379
]
@@ -469,13 +469,13 @@ tests = testGroup "diagnostics"
469
469
bdoc <- createDoc bPath " haskell" bSource
470
470
_pdoc <- createDoc pPath " haskell" pSource
471
471
expectDiagnostics
472
- [(" P.hs" , [(DiagnosticSeverity_Warning ,(4 ,0 ), " Top-level binding" , Nothing )])] -- So that we know P has been loaded
472
+ [(" P.hs" , [(DiagnosticSeverity_Warning ,(4 ,0 ), " Top-level binding" , Just " GHC-38417 " )])] -- So that we know P has been loaded
473
473
474
474
-- Change y from Int to B which introduces a type error in A (imported from P)
475
475
changeDoc bdoc [TextDocumentContentChangeEvent . InR . TextDocumentContentChangeWholeDocument $
476
476
T. unlines [" module B where" , " y :: Bool" , " y = undefined" ]]
477
477
expectDiagnostics
478
- [(" A.hs" , [(DiagnosticSeverity_Error , (5 , 4 ), " Couldn't match expected type 'Int' with actual type 'Bool'" , Nothing )])
478
+ [(" A.hs" , [(DiagnosticSeverity_Error , (5 , 4 ), " Couldn't match expected type 'Int' with actual type 'Bool'" , Just " GHC-83865 " )])
479
479
]
480
480
481
481
-- Open A and edit to fix the type error
@@ -485,8 +485,8 @@ tests = testGroup "diagnostics"
485
485
486
486
expectDiagnostics
487
487
[ ( " P.hs" ,
488
- [ (DiagnosticSeverity_Error , (4 , 6 ), " Couldn't match expected type 'Int' with actual type 'Bool'" , Nothing ),
489
- (DiagnosticSeverity_Warning , (4 , 0 ), " Top-level binding" , Nothing )
488
+ [ (DiagnosticSeverity_Error , (4 , 6 ), " Couldn't match expected type 'Int' with actual type 'Bool'" , Just " GHC-83865 " ),
489
+ (DiagnosticSeverity_Warning , (4 , 0 ), " Top-level binding" , Just " GHC-38417 " )
490
490
]
491
491
),
492
492
(" A.hs" , [] )
@@ -564,7 +564,7 @@ cancellationTemplate (edit, undoEdit) mbKey = testCase (maybe "-" fst mbKey) $ r
564
564
]
565
565
566
566
-- for the example above we expect one warning
567
- let missingSigDiags = [(DiagnosticSeverity_Warning , (3 , 0 ), " Top-level binding" , Nothing ) ]
567
+ let missingSigDiags = [(DiagnosticSeverity_Warning , (3 , 0 ), " Top-level binding" , Just " GHC-38417 " ) ]
568
568
typeCheck doc >> expectCurrentDiagnostics doc missingSigDiags
569
569
570
570
-- Now we edit the document and wait for the given key (if any)
0 commit comments