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

Incorrect module type from type-enclosing #1763

Open
liam923 opened this issue May 10, 2024 · 1 comment
Open

Incorrect module type from type-enclosing #1763

liam923 opened this issue May 10, 2024 · 1 comment
Labels

Comments

@liam923
Copy link
Contributor

liam923 commented May 10, 2024

With test.ml having contents:

include struct
  open struct
    let hidden = 3
  end
  let visible = 4
end

I get the following unexpected behavior:

$ ocamlmerlin single type-enclosing -position 6:0 < scratch/test.ml | jq '.value[].type'
"sig val hidden : int val visible : int end"
"sig val visible : int end"

Although the correct type is included in the returned list, in VSCode with the OCaml Platform extension (I haven't tested other editors), the incorrect sig val hidden : int val visible : int end module type is shown.

Note that this error does not occur with the following similar programs:

module Foo = struct
  let hidden = 3
end

include struct
  open Foo
  let visible = 4
end
$ ocamlmerlin single type-enclosing -position 8:0 < scratch/test.ml | jq '.value[].type'
"sig val visible : int end"
include struct
  module Foo = struct
    let hidden = 3
  end
  open Foo
  let visible = 4
end
$ ocamlmerlin single type-enclosing -position 7:0 < scratch/test.ml | jq '.value[].type'
"sig module Foo : sig val hidden : int end val visible : int end"

Version: 9afb03689bc500fed0f18d612f3b13ad668e2455 (master at the time of creating this)

@voodoos
Copy link
Collaborator

voodoos commented May 22, 2024

That's surprising, and definitely a bug, thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants