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
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
I gave a bit of a go at debugging this, but I got stuck. It seems that short paths tries to write the type in terms of the first Foo.t, but it recognizes that the first Foo isn't visible, so it invalidates that path. Then, it doesn't ever try writing in terms of the second Foo, which comes into scope via the open.
The text was updated successfully, but these errors were encountered:
Here's a cram test demonstrating the issue:
I gave a bit of a go at debugging this, but I got stuck. It seems that short paths tries to write the type in terms of the first
Foo.t
, but it recognizes that the firstFoo
isn't visible, so it invalidates that path. Then, it doesn't ever try writing in terms of the secondFoo
, which comes into scope via theopen
.The text was updated successfully, but these errors were encountered: