Skip to content

Incorrect module type from type-enclosing #1763

@liam923

Description

@liam923

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions