Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
Tests for issue 310 (misleading hover on inner signature) (#311)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jacg authored and cocreature committed Jan 8, 2020
1 parent b7208a3 commit 5f4384e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/data/GotoHover.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ documented :: Monad m => Either Int (m a)
documented = Left 7518

listOfInt = [ 8391 :: Int, 6268 ]

outer :: Bool
outer = undefined where

inner :: Char
inner = undefined
4 changes: 4 additions & 0 deletions test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,8 @@ findDefinitionAndHoverTests = let
chrL36 = Position 36 25 ; litC = [ExpectHoverText ["'t'"]]
txtL8 = Position 8 14 ; litT = [ExpectHoverText ["\"dfgv\""]]
lstL43 = Position 43 12 ; litL = [ExpectHoverText ["[ 8391 :: Int, 6268 ]"]]
outL45 = Position 45 3 ; outSig = [ExpectHoverText ["outer", "Bool"], mkR 46 0 46 5]
innL48 = Position 48 5 ; innSig = [ExpectHoverText ["inner", "Char"], mkR 49 2 49 7]
in
mkFindTests
-- def hover look expect
Expand Down Expand Up @@ -1133,6 +1135,8 @@ findDefinitionAndHoverTests = let
, test no broken txtL8 litT "literal Text in hover info #274"
, test no broken lstL43 litL "literal List in hover info #274"
, test no broken docL41 constr "type constraint in hover info #283"
, test broken broken outL45 outSig "top-level signature #310"
, test broken broken innL48 innSig "inner signature #310"
]
where yes, broken :: (TestTree -> Maybe TestTree)
yes = Just -- test should run and pass
Expand Down

0 comments on commit 5f4384e

Please sign in to comment.