Skip to content

Commit 522e8ca

Browse files
committed
Fix reference to interfaces
1 parent 55c82b4 commit 522e8ca

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

analysis/src/References.ml

+9-5
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,19 @@ let allReferencesForLocItem ~full:({file; package} as full) locItem =
483483
(Uri2.fromPath loc.Location.loc_start.pos_fname, [loc])))
484484
|> List.flatten
485485
in
486-
let targetModuleReference =
486+
let targetModuleReferences =
487487
match Hashtbl.find_opt package.pathsForModule moduleName with
488488
| None -> []
489489
| Some paths -> (
490-
match SharedTypes.getSrc paths with
491-
| None -> []
492-
| Some src -> [(Uri2.fromPath src, [Utils.topLoc src])])
490+
let moduleSrcToRef src = (Uri2.fromPath src, [Utils.topLoc src]) in
491+
match paths with
492+
| Impl (_, None) -> []
493+
| Impl (_, Some src) -> [moduleSrcToRef src]
494+
| Intf (_, srci) -> [moduleSrcToRef srci]
495+
| IntfAndImpl (_, srci, _, src) ->
496+
[moduleSrcToRef srci; moduleSrcToRef src])
493497
in
494-
List.append targetModuleReference otherModulesReferences
498+
List.append targetModuleReferences otherModulesReferences
495499
| Typed (_, _, NotFound) | LModule NotFound | Constant _ -> []
496500
| TypeDefinition (_, _, stamp) -> forLocalStamp ~full stamp Type
497501
| Typed (_, _, (LocalReference (stamp, tip) | Definition (stamp, tip)))

0 commit comments

Comments
 (0)