You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Find references of included members from their root declaration #9524
#9331 finds the references of a member brought in by include by walking families of copies: the copies in a file, the other file of a .res/.resi pair, and the files the copies come from, with a visited set so each family is gathered once. Uses in other files are matched by their keys and, since #9329, by resolving their paths.
A simpler design would work from the declaration itself:
Follow the queried member back to its root declaration: through include_origin in its file, into other files, and from a .resi member to its .res counterpart.
In the one pass over the project, accept a use when its resolved member has the same root.
In each file, take the internal references of the copies whose root is that declaration.
This would replace include_family, families_in_file, alternate_stamps, the recursion and the visited set in analysis/src/references.ml. It would also find two kinds of uses that #9331 misses:
uses through the including file's path when Find References starts from the declaration in another file, such as Main.x for Lib.x after include Lib in Main.res;
uses through a sibling copy, such as S.x when another module also includes the functor result.
The cost per query needs measuring: finding the root of every candidate use and copy goes through resolve_global, so the resolutions should be cached per query as external_references does.
Activity