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.