Ignore none locations instead of ghost locations
#110
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the occurrences query ignores identifiers if their location is "ghost". This causes issues with finding occurrences in the presence of let punning. Also, this probably produces some undesirable behavior in the presence of ppxs (occurrences within ppx-generated code will be ignored). This PR changes occurrences to instead ignore identifiers whose location is
Location.none.This PR also causes the occurrences query to begin filtering occurrences read from an index file. This goes in hand with this flambda PR, which causes occurrences in cmt/cms files to not be pre-filtered. Before, flambda also filtered "ghost" locations when producing cmt/cms files. Now, it will do no filtering, leaving the onus on Merlin.
Because of this, one of the tests introduced by this PR is left unfixed - it will be corrected once the flambda PR is merged. I've made a separate draft PR (#109) that contains the changes from this PR, but it is based on the flambda version that contains the relevant patch. In that draft PR, the test is corrected and passing.