Skip to content

Commit 03c8409

Browse files
dylan-thinnesJaro Reinders
authored and
Jaro Reinders
committed
Fix build issues with other tests from expectDiagnostics
1 parent 1b2dd28 commit 03c8409

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

ghcide-bench/src/Experiments.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ experiments =
266266
flip allM docs $ \DocumentPositions{..} -> do
267267
bottom <- pred . length . T.lines <$> documentContents doc
268268
diags <- getCurrentDiagnostics doc
269-
case requireDiagnostic diags (DiagnosticSeverity_Error, (fromIntegral bottom, 8), "Found hole", Nothing) of
269+
case requireDiagnostic diags (DiagnosticSeverity_Error, (fromIntegral bottom, 8), "Found hole", Just "88464", Nothing) of
270270
Nothing -> pure True
271271
Just _err -> pure False
272272
),

plugins/hls-refactor-plugin/test/Main.hs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ suggestImportDisambiguationTests = testGroup "suggest import disambiguation acti
19961996
compareHideFunctionTo = compareTwo "HideFunction.hs"
19971997
withTarget file locs k = runWithExtraFiles "hiding" $ \dir -> do
19981998
doc <- openDoc file "haskell"
1999-
void $ expectDiagnostics [(file, [(DiagnosticSeverity_Error, loc, "Ambiguous occurrence") | loc <- locs])]
1999+
void $ expectDiagnostics [(file, [(DiagnosticSeverity_Error, loc, "Ambiguous occurrence", Nothing) | loc <- locs])] -- TODO: Give this a proper error
20002000
actions <- getAllCodeActions doc
20012001
k dir doc actions
20022002
withHideFunction = withTarget ("HideFunction" <.> "hs")
@@ -2455,7 +2455,7 @@ deleteUnusedDefinitionTests = testGroup "delete unused definition action"
24552455
where
24562456
testFor sourceLines pos@(l,c) expectedTitle expectedLines = do
24572457
docId <- createDoc "A.hs" "haskell" $ T.unlines sourceLines
2458-
expectDiagnostics [ ("A.hs", [(DiagnosticSeverity_Warning, pos, "not used")]) ]
2458+
expectDiagnostics [ ("A.hs", [(DiagnosticSeverity_Warning, pos, "not used", Nothing)]) ]
24592459
action <- pickActionWithTitle expectedTitle =<< getCodeActions docId (R l c l c)
24602460
executeCodeAction action
24612461
contentAfterAction <- documentContents docId
@@ -2471,8 +2471,8 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
24712471
, "f = 1"
24722472
]
24732473
(if ghcVersion >= GHC94
2474-
then [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the type variable") ]
2475-
else [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the following constraint") ])
2474+
then [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the type variable", Nothing) ]
2475+
else [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the following constraint", Nothing) ])
24762476
"Add type annotation ‘Integer’ to ‘1’"
24772477
[ "{-# OPTIONS_GHC -Wtype-defaults #-}"
24782478
, "module A (f) where"
@@ -2490,8 +2490,8 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
24902490
, " in x"
24912491
]
24922492
(if ghcVersion >= GHC94
2493-
then [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the type variable") ]
2494-
else [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the following constraint") ])
2493+
then [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the type variable", Nothing) ]
2494+
else [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the following constraint", Nothing) ])
24952495
"Add type annotation ‘Integer’ to ‘3’"
24962496
[ "{-# OPTIONS_GHC -Wtype-defaults #-}"
24972497
, "module A where"
@@ -2510,8 +2510,8 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
25102510
, " in x"
25112511
]
25122512
(if ghcVersion >= GHC94
2513-
then [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the type variable") ]
2514-
else [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the following constraint") ])
2513+
then [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the type variable", Nothing) ]
2514+
else [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the following constraint", Nothing) ])
25152515
"Add type annotation ‘Integer’ to ‘5’"
25162516
[ "{-# OPTIONS_GHC -Wtype-defaults #-}"
25172517
, "module A where"
@@ -2532,12 +2532,12 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
25322532
]
25332533
(if ghcVersion >= GHC94
25342534
then
2535-
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the type variable")
2536-
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the type variable")
2535+
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the type variable", Nothing)
2536+
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the type variable", Nothing)
25372537
]
25382538
else
2539-
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the following constraint")
2540-
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the following constraint")
2539+
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the following constraint", Nothing)
2540+
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the following constraint", Nothing)
25412541
])
25422542
"Add type annotation ‘String’ to ‘\"debug\""
25432543
[ "{-# OPTIONS_GHC -Wtype-defaults #-}"
@@ -2559,8 +2559,8 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
25592559
, "f a = traceShow \"debug\" a"
25602560
]
25612561
(if ghcVersion >= GHC94
2562-
then [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the type variable") ]
2563-
else [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the following constraint") ])
2562+
then [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the type variable", Nothing) ]
2563+
else [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the following constraint", Nothing) ])
25642564
"Add type annotation ‘String’ to ‘\"debug\""
25652565
[ "{-# OPTIONS_GHC -Wtype-defaults #-}"
25662566
, "{-# LANGUAGE OverloadedStrings #-}"
@@ -2581,8 +2581,8 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
25812581
, "f = seq (\"debug\" :: [Char]) (seq (\"debug\" :: [Char]) (traceShow \"debug\"))"
25822582
]
25832583
(if ghcVersion >= GHC94
2584-
then [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the type variable") ]
2585-
else [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the following constraint") ])
2584+
then [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the type variable", Nothing) ]
2585+
else [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the following constraint", Nothing) ])
25862586
"Add type annotation ‘String’ to ‘\"debug\""
25872587
[ "{-# OPTIONS_GHC -Wtype-defaults #-}"
25882588
, "{-# LANGUAGE OverloadedStrings #-}"
@@ -2597,7 +2597,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
25972597
testFor sourceLines diag expectedTitle expectedLines = do
25982598
docId <- createDoc "A.hs" "haskell" $ T.unlines sourceLines
25992599
expectDiagnostics [ ("A.hs", diag) ]
2600-
let cursors = map snd3 diag
2600+
let cursors = map (\(_, snd, _, _) -> snd) diag
26012601
(ls, cs) = minimum cursors
26022602
(le, ce) = maximum cursors
26032603

test/functional/Config.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ genericConfigTests = testGroup "generic plugin config"
6767
expectDiagnostics standardDiagnostics
6868
]
6969
where
70-
standardDiagnostics = [("Foo.hs", [(DiagnosticSeverity_Warning, (1,0), "Top-level binding")])]
71-
testPluginDiagnostics = [("Foo.hs", [(DiagnosticSeverity_Error, (0,0), "testplugin")])]
70+
standardDiagnostics = [("Foo.hs", [(DiagnosticSeverity_Warning, (1,0), "Top-level binding", Nothing)])]
71+
testPluginDiagnostics = [("Foo.hs", [(DiagnosticSeverity_Error, (0,0), "testplugin", Nothing)])]
7272

7373
runConfigSession subdir session = do
7474
failIfSessionTimeout $
@@ -90,7 +90,7 @@ genericConfigTests = testGroup "generic plugin config"
9090
files <- getFilesOfInterestUntracked
9191
void $ uses_ GetTestDiagnostics $ HM.keys files
9292
define mempty $ \GetTestDiagnostics file -> do
93-
let diags = [ideErrorText file "testplugin"]
93+
let diags = [ideErrorText Nothing file "testplugin"]
9494
return (diags,Nothing)
9595
}
9696
-- A config that disables the plugin initially

0 commit comments

Comments
 (0)