Skip to content

[tooling] Associate Uids to items that don't have a concrete definition #14120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

voodoos
Copy link
Contributor

@voodoos voodoos commented Jul 1, 2025

Since #12142 the compiler index items usages and write that information into the cmt files. This indexation enable tools like Merlin to answer project-wide occurrences and renaming queries. Since this is based on mapping definitions uids to locations, it means that usages of objects that don't have a concrete definition at compile time are missing in the index.

This happens in a least two cases: when using components of a functor's parameter inside this functor body and when unpacking a first class module.

This PR proposes to generate new uids that are specific to one module parameter, or to one unpacking. These uids are paired with their declaration's uids, allowing feature like renaming to adequately handle these usages.

This PR also move the logic to pair uids to the shape module to prevent a cyclic dependency.

cc @Octachron (and maybe @gasche ?)

@voodoos voodoos changed the title [tooling] Associate Uids to items that don't have a concrete definitions [tooling] Associate Uids to items that don't have a concrete definition Jul 1, 2025
Missing uid: Z.s (File "index_aliases.ml", line 45, characters 8-11)
Alias: Index_aliases.23 -> Approximated: Index_aliases.22:
Resolved decl: [G]Index_aliases.2:
Z.s (File "index_aliases.ml", line 45, characters 8-11)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment in the test file should be updated.

@Octachron Octachron self-assigned this Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants