Skip to content

Inconsistent behavior between Merlin commands in presence of unbound module #1567

@ddickstein

Description

@ddickstein

Consider this code:

let x = false
let f () =
  let open Unknown in
  x
;;

Since x may be present in the unknown module we are attempting to open, we can't really be sure we're talking about the x defined at the top. type-enclosing assumes that we are, and reports bool, but locate does not assume that, and fails with "Not in environment 'x'".

I think that the better behavior is probably to assume we're talking about the x that's available, as type-enclosing does, and that locate should be fixed to jump to x as well. But if that's considered unprincipled, we need a clearer error message than "Not in environment," and it needs to apply consistently across commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions