Skip to content

Commit 25b8201

Browse files
committed
Correct instance for incoming
1 parent 2358362 commit 25b8201

File tree

2 files changed

+13
-4
lines changed
  • plugins/hls-call-hierarchy-plugin

2 files changed

+13
-4
lines changed

plugins/hls-call-hierarchy-plugin/src/Ide/Plugin/CallHierarchy/Query.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ incomingCalls (getConn -> conn) symbol = do
2121
let (o, m, u) = parseSymbol symbol
2222
query conn
2323
(Query $ T.pack $ concat
24-
[ "SELECT mods.mod, defs.occ, mods.hs_src, defs.sl, defs.sc, "
25-
, "defs.el, defs.ec, refs.sl, refs.sc, refs.el, refs.ec "
24+
[ "SELECT mods.mod, decls.occ, mods.hs_src, decls.sl, decls.sc, "
25+
, "decls.el, decls.ec, refs.sl, refs.sc, refs.el, refs.ec "
2626
, "FROM refs "
2727
, "JOIN decls ON decls.hieFile = refs.hieFile "
28-
, "JOIN defs ON defs.hieFile = decls.hieFile AND defs.occ = decls.occ "
2928
, "JOIN mods ON mods.hieFile = decls.hieFile "
3029
, "where "
3130
, "(refs.occ = ? AND refs.mod = ? AND refs.unit = ?) "

plugins/hls-call-hierarchy-plugin/test/Main.hs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,24 @@ incomingCallsTests =
254254
positions = [(0, 6)]
255255
ranges = [mkRange 0 16 0 17]
256256
incomingCallTestCase contents 1 20 positions ranges
257+
, testCase "goto typeclass instance" $ do
258+
let contents = T.unlines
259+
[ "class F a where f :: a"
260+
, "instance F Bool where f = x"
261+
, "instance F Int where f = 3"
262+
, "x = True"
263+
]
264+
positions = [(1, 22)]
265+
ranges = [mkRange 1 26 1 27]
266+
incomingCallTestCase contents 3 0 positions ranges
257267
]
258268
, testCase "type family instance" $ do
259269
let contents = T.unlines
260270
[ "{-# LANGUAGE TypeFamilies #-}"
261271
, "type family A a"
262272
, "type instance A Int = Char"
263273
]
264-
positions = [(1, 12)]
274+
positions = [(2, 14)]
265275
ranges = [mkRange 2 22 2 26]
266276
incomingCallTestCase contents 2 22 positions ranges
267277
, testCase "GADT" $ do

0 commit comments

Comments
 (0)