Skip to content
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

Additionnal short-paths tests #1904

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ unreleased
of the involved data-structures. (#1889)
+ test suite
- Add a test case illustrating wrong open order proposed in issue #1900. (#1901)
- Add more short-paths tests cases (#1904)

merlin 5.4.1
============
Expand Down
45 changes: 45 additions & 0 deletions tests/test-dirs/short-paths/issue1873.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
We get a bad path for `hello`

$ cat > foo.ml <<EOF
> module Foo = struct
> type t
> end
>
> module Bar = struct
> module Foo = struct
> type t = Foo.t
> end
> end
>
> open! Bar
>
> let hello : Foo.t = 0
> EOF

It happens regardless of whether short-paths is enabled
$ $MERLIN single type-enclosing -position 13:5 -filename foo.ml < foo.ml | jq .value[0].type -r
Bar.Foo.t

$ echo "FLG -short-paths" > .merlin
$ $MERLIN single type-enclosing -position 13:5 -filename foo.ml < foo.ml | jq .value[0].type -r
Bar.Foo.t

It seems to be related to shadowing somehow. This works:
$ cat > foo.ml <<EOF
> module Foo = struct
> type t
> end
>
> module Bar = struct
> module Baz = struct
> type t = Foo.t
> end
> end
>
> open! Bar
>
> let hello : Baz.t = 0
> EOF

$ $MERLIN single type-enclosing -position 13:5 -filename foo.ml < foo.ml | jq .value[0].type -r
Foo.t
Loading