-
Notifications
You must be signed in to change notification settings - Fork 15
Ignore none locations instead of ghost locations
#110
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1c7e3d1
Add tests demonstrating occurrences on punned expressions
liam923 0d1adc1
Fix occurrences with let punning
liam923 48d7c72
Add comment to should_ignore_lid
liam923 0e9e3bd
Include location of entire identifier
liam923 db389a2
Don't filter hidden nodes when doing occurrences
liam923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
tests/test-dirs/occurrences/project-wide/punning.t/definitions.ml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| let a = Some 1 | ||
|
|
||
| type t = { value : string } | ||
| let value = "hello" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| Test project-wide occurrences in the presence of punning (both let and record punning) | ||
|
|
||
| Compile project, create index file, and configure Merlin to use index file | ||
| $ $OCAMLC -bin-annot -bin-annot-occurrences -c definitions.ml usages.ml | ||
| $ ocaml-index aggregate definitions.cmt usages.cmt | ||
| $ cat > .merlin << EOF | ||
| > INDEX project.ocaml-index | ||
| > EOF | ||
|
|
||
| Convenience function for querying occurrences | ||
| $ occurrences () { | ||
| > file="$1" | ||
| > location="$2" | ||
| > $MERLIN single occurrences -scope project -identifier-at "$location" -filename "$file" < "$file" | \ | ||
| > jq -r '.value[] | "\(.file) \(.start.line):\(.start.col)-\(.end.col)"' | ||
| > } | ||
|
|
||
| Get occurrences of an identifier that is used as the expression part of a punned let | ||
| expression | ||
| FIXME: this should also include the occurrence on line 6 of usages.ml | ||
| $ occurrences definitions.ml 1:4 | ||
| $TESTCASE_ROOT/definitions.ml 1:4-5 | ||
|
|
||
| Get occurrences, with the cursor pointing at the identifier in a punned let. | ||
| Merlin returns the occurrences of the new variable bound in that let, rather than the | ||
| expression being assigned to the variable. | ||
| $ occurrences usages.ml 6:7 | ||
| $TESTCASE_ROOT/usages.ml 6:7-8 | ||
| $TESTCASE_ROOT/usages.ml 7:7-8 | ||
|
|
||
| Get occurrences of a record field, where there is an instance of punning that field while | ||
| creating a record | ||
| $ occurrences definitions.ml 3:13 | ||
| $TESTCASE_ROOT/definitions.ml 3:11-16 | ||
| $TESTCASE_ROOT/usages.ml 10:10-15 | ||
|
|
||
| Get occurrences of a variable that is used as the value being placed into a record in a | ||
| punned record field expression | ||
| $ occurrences definitions.ml 4:6 | ||
| $TESTCASE_ROOT/definitions.ml 4:4-9 | ||
| $TESTCASE_ROOT/usages.ml 10:10-15 | ||
|
|
||
| Get occurrences, with the cursor pointing at a punned record field expression. | ||
| Merlin finds occurrences of the value being placed into the record rather than the record | ||
| field | ||
| $ occurrences usages.ml 10:12 | ||
| $TESTCASE_ROOT/definitions.ml 4:4-9 | ||
| $TESTCASE_ROOT/usages.ml 10:10-15 |
10 changes: 10 additions & 0 deletions
10
tests/test-dirs/occurrences/project-wide/punning.t/usages.ml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| include Definitions | ||
|
|
||
| (* Let punning *) | ||
| let _ = | ||
| let (let*) = Option.bind in | ||
| let* a in | ||
| Some a | ||
|
|
||
| (* Record field punning *) | ||
| let _ = { value } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ | |
| "file": "$TESTCASE_ROOT/main.ml", | ||
| "start": { | ||
| "line": 1, | ||
| "col": 26 | ||
| "col": 22 | ||
| }, | ||
| "end": { | ||
| "line": 1, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ | |
| "file": "$TESTCASE_ROOT/main.ml", | ||
| "start": { | ||
| "line": 1, | ||
| "col": 26 | ||
| "col": 22 | ||
| }, | ||
| "end": { | ||
| "line": 1, | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.