Skip to content

Commit 5f4384e

Browse files
jacgcocreature
authored andcommitted
Tests for issue 310 (misleading hover on inner signature) (#311)
* Tests for issue 310 (misleading hover on inner signature) The most important pair of tests here is the "inner signature" pair. The others serve mainly to document, compare and contrast what is happening in related situations. In summary, hover and gotoDef + on inner signatures: give type and location information for the outer definition; this is misleading, + on outer signatures: give no information at all, + on inner definitions: give correct information for the inner definition, + on outer definitions: give correct information for the outer definition. Should hover and gotoDef do anything at all for signatures? or is the current behaviour for outer signatures (doing nothing at all) what we want? * Require signature hover/gotoDef to point to first clause of definition * Remove perhaps superfluous tests for definitions
1 parent b7208a3 commit 5f4384e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

test/data/GotoHover.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@ documented :: Monad m => Either Int (m a)
4242
documented = Left 7518
4343

4444
listOfInt = [ 8391 :: Int, 6268 ]
45+
46+
outer :: Bool
47+
outer = undefined where
48+
49+
inner :: Char
50+
inner = undefined

test/exe/Main.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,8 @@ findDefinitionAndHoverTests = let
10981098
chrL36 = Position 36 25 ; litC = [ExpectHoverText ["'t'"]]
10991099
txtL8 = Position 8 14 ; litT = [ExpectHoverText ["\"dfgv\""]]
11001100
lstL43 = Position 43 12 ; litL = [ExpectHoverText ["[ 8391 :: Int, 6268 ]"]]
1101+
outL45 = Position 45 3 ; outSig = [ExpectHoverText ["outer", "Bool"], mkR 46 0 46 5]
1102+
innL48 = Position 48 5 ; innSig = [ExpectHoverText ["inner", "Char"], mkR 49 2 49 7]
11011103
in
11021104
mkFindTests
11031105
-- def hover look expect
@@ -1133,6 +1135,8 @@ findDefinitionAndHoverTests = let
11331135
, test no broken txtL8 litT "literal Text in hover info #274"
11341136
, test no broken lstL43 litL "literal List in hover info #274"
11351137
, test no broken docL41 constr "type constraint in hover info #283"
1138+
, test broken broken outL45 outSig "top-level signature #310"
1139+
, test broken broken innL48 innSig "inner signature #310"
11361140
]
11371141
where yes, broken :: (TestTree -> Maybe TestTree)
11381142
yes = Just -- test should run and pass

0 commit comments

Comments
 (0)