Skip to content

Commit 9f62337

Browse files
michaelpjmergify[bot]pepeiborra
authored
Add failing test for variables in hovers (#2742)
Witnesses #2716. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Pepe Iborra <pepeiborra@gmail.com>
1 parent 82a3cd5 commit 9f62337

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ghcide/test/data/hover/GotoHover.hs

+3
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ aa2 = $(id [| True |])
6161

6262
hole :: Int
6363
hole = _
64+
65+
hole2 :: a -> Maybe a
66+
hole2 = _

ghcide/test/exe/Main.hs

+9-1
Original file line numberDiff line numberDiff line change
@@ -4059,7 +4059,9 @@ findDefinitionAndHoverTests = let
40594059
, testGroup "hover" $ mapMaybe snd tests
40604060
, checkFileCompiles sourceFilePath $
40614061
expectDiagnostics
4062-
[ ( "GotoHover.hs", [(DsError, (62, 7), "Found hole: _")]) ]
4062+
[ ( "GotoHover.hs", [(DsError, (62, 7), "Found hole: _")])
4063+
, ( "GotoHover.hs", [(DsError, (65, 8), "Found hole: _")])
4064+
]
40634065
, testGroup "type-definition" typeDefinitionTests ]
40644066

40654067
typeDefinitionTests = [ tst (getTypeDefinitions, checkDefs) aaaL14 (pure tcData) "Saturated data con"
@@ -4111,6 +4113,7 @@ findDefinitionAndHoverTests = let
41114113
outL45 = Position 49 3 ; outSig = [ExpectHoverText ["outer", "Bool"], mkR 50 0 50 5]
41124114
innL48 = Position 52 5 ; innSig = [ExpectHoverText ["inner", "Char"], mkR 49 2 49 7]
41134115
holeL60 = Position 62 7 ; hleInfo = [ExpectHoverText ["_ ::"]]
4116+
holeL65 = Position 65 8 ; hleInfo2 = [ExpectHoverText ["_ :: a -> Maybe a"]]
41144117
cccL17 = Position 17 16 ; docLink = [ExpectHoverText ["[Documentation](file:///"]]
41154118
imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo", "Haddock"], mkL foo 5 0 5 3]
41164119
reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], mkL bar 3 0 3 14]
@@ -4165,6 +4168,11 @@ findDefinitionAndHoverTests = let
41654168
, test no yes outL45 outSig "top-level signature #767"
41664169
, test broken broken innL48 innSig "inner signature #767"
41674170
, test no yes holeL60 hleInfo "hole without internal name #831"
4171+
, if ghcVersion >= GHC92 then
4172+
-- Broken on GHC 9.2 and above due to printing of uniques
4173+
test no yes holeL65 [] "hole with variable"
4174+
else
4175+
test no yes holeL65 hleInfo2 "hole with variable"
41684176
, test no skip cccL17 docLink "Haddock html links"
41694177
, testM yes yes imported importedSig "Imported symbol"
41704178
, testM yes yes reexported reexportedSig "Imported symbol (reexported)"

0 commit comments

Comments
 (0)