jon.recoil.org

Module Ocaml_typing.Env

type value_unbound_reason =
  1. | Val_unbound_instance_variable
  2. | Val_unbound_self
  3. | Val_unbound_ancestor
  4. | Val_unbound_ghost_recursive of Ocaml_parsing.Location.t
type module_unbound_reason =
  1. | Mod_unbound_illegal_recursion of {
    1. container : string option;
    2. unbound : string;
    }
type address =
  1. | Aident of Ocaml_typing.Ident.t
  2. | Adot of Ocaml_typing.Env.address * int
type t
val empty : Ocaml_typing.Env.t
val initial : Ocaml_typing.Env.t
val same_type_declarations : Ocaml_typing.Env.t -> Ocaml_typing.Env.t -> bool
type type_descriptions = Ocaml_typing.Env.type_descr_kind
type iter_cont
val same_types : Ocaml_typing.Env.t -> Ocaml_typing.Env.t -> bool
val used_persistent : unit -> Merlin_utils.Misc.String.Set.t
val find_shadowed_types : Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> Ocaml_typing.Path.t list
val without_cmis : ('a -> 'b) -> 'a -> 'b
val find_strengthened_module : aliasable:bool -> Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> Ocaml_typing.Types.module_type
val is_functor_arg : Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> bool
val reset_required_globals : unit -> unit
val get_required_globals : unit -> Ocaml_typing.Ident.t list
val add_required_global : Ocaml_typing.Ident.t -> unit
val has_local_constraints : Ocaml_typing.Env.t -> bool
val mark_value_used : Ocaml_typing.Types.Uid.t -> unit
val mark_module_used : Ocaml_typing.Types.Uid.t -> unit
val mark_type_used : Ocaml_typing.Types.Uid.t -> unit
type constructor_usage =
  1. | Positive
  2. | Pattern
  3. | Exported_private
  4. | Exported
val mark_constructor_used : Ocaml_typing.Env.constructor_usage -> Ocaml_typing.Types.Uid.t -> unit
type label_usage =
  1. | Projection
  2. | Mutation
  3. | Construct
  4. | Exported_private
  5. | Exported
type unbound_value_hint =
  1. | No_hint
  2. | Missing_rec of Ocaml_parsing.Location.t
type lookup_error =
  1. | Unbound_value of Ocaml_parsing.Longident.t * Ocaml_typing.Env.unbound_value_hint
  2. | Unbound_type of Ocaml_parsing.Longident.t
  3. | Unbound_constructor of Ocaml_parsing.Longident.t
  4. | Unbound_label of Ocaml_parsing.Longident.t
  5. | Unbound_module of Ocaml_parsing.Longident.t
  6. | Unbound_class of Ocaml_parsing.Longident.t
  7. | Unbound_modtype of Ocaml_parsing.Longident.t
  8. | Unbound_cltype of Ocaml_parsing.Longident.t
  9. | Unbound_instance_variable of string
  10. | Not_an_instance_variable of string
  11. | Masked_instance_variable of Ocaml_parsing.Longident.t
  12. | Masked_self_variable of Ocaml_parsing.Longident.t
  13. | Masked_ancestor_variable of Ocaml_parsing.Longident.t
  14. | Structure_used_as_functor of Ocaml_parsing.Longident.t
  15. | Abstract_used_as_functor of Ocaml_parsing.Longident.t
  16. | Functor_used_as_structure of Ocaml_parsing.Longident.t
  17. | Abstract_used_as_structure of Ocaml_parsing.Longident.t
  18. | Generative_used_as_applicative of Ocaml_parsing.Longident.t
  19. | Illegal_reference_to_recursive_module of {
    1. container : string option;
    2. unbound : string;
    }
  20. | Illegal_reference_to_recursive_class_type of {
    1. container : string option;
    2. unbound : string;
    3. unbound_class_type : Ocaml_parsing.Longident.t;
    4. container_class_type : string;
    }
  21. | Cannot_scrape_alias of Ocaml_parsing.Longident.t * Ocaml_typing.Path.t
val lookup_module_path : ?use:bool -> loc:Ocaml_parsing.Location.t -> load:bool -> Ocaml_parsing.Longident.t -> Ocaml_typing.Env.t -> Ocaml_typing.Path.t
val lookup_all_constructors_from_type : ?use:bool -> loc:Ocaml_parsing.Location.t -> Ocaml_typing.Env.constructor_usage -> Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> (Ocaml_typing.Data_types.constructor_description * (unit -> unit)) list
val lookup_all_labels_from_type : ?use:bool -> loc:Ocaml_parsing.Location.t -> Ocaml_typing.Env.label_usage -> Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> (Ocaml_typing.Data_types.label_description * (unit -> unit)) list
val find_value_index : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> int option

The find_*_index functions computes a "namespaced" De Bruijn index of an identifier in a given environment. In other words, it returns how many times an identifier has been shadowed by a more recent identifiers with the same name in a given environment. Those functions return None when the identifier is not bound in the environment. This behavior is there to facilitate the detection of inconsistent printing environment, but should disappear in the long term.

val find_type_index : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> int option
val find_module_index : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> int option
val find_modtype_index : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> int option
val find_class_index : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> int option
val find_cltype_index : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> int option
val bound_value : string -> Ocaml_typing.Env.t -> bool
val bound_module : string -> Ocaml_typing.Env.t -> bool
val bound_type : string -> Ocaml_typing.Env.t -> bool
val bound_modtype : string -> Ocaml_typing.Env.t -> bool
val bound_class : string -> Ocaml_typing.Env.t -> bool
val bound_cltype : string -> Ocaml_typing.Env.t -> bool
val add_persistent_structure : Ocaml_typing.Ident.t -> Ocaml_typing.Env.t -> Ocaml_typing.Env.t
val persistent_structures_of_dir : Ocaml_utils.Load_path.Dir.t -> Merlin_utils.Misc.String.Set.t
val filter_non_loaded_persistent : (Ocaml_typing.Ident.t -> bool) -> Ocaml_typing.Env.t -> Ocaml_typing.Env.t
val open_signature : ?used_slot:bool Stdlib.ref -> ?loc:Ocaml_parsing.Location.t -> ?toplevel:bool -> Ocaml_parsing.Asttypes.override_flag -> Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> (Ocaml_typing.Env.t, [ `Not_found | `Functor ]) Stdlib.result
val open_pers_signature : string -> Ocaml_typing.Env.t -> (Ocaml_typing.Env.t, [ `Not_found ]) Stdlib.result
val remove_last_open : Ocaml_typing.Path.t -> Ocaml_typing.Env.t -> Ocaml_typing.Env.t option
val enter_type : ?long_path:bool -> scope:int -> string -> Ocaml_typing.Types.type_declaration -> Ocaml_typing.Env.t -> Ocaml_typing.Ident.t * Ocaml_typing.Env.t
val enter_extension : scope:int -> rebind:bool -> string -> Ocaml_typing.Types.extension_constructor -> Ocaml_typing.Env.t -> Ocaml_typing.Ident.t * Ocaml_typing.Env.t
val reset_cache : unit -> unit
val reset_cache_toplevel : unit -> unit
val set_current_unit : Ocaml_parsing.Unit_info.t -> unit
val get_current_unit : unit -> Ocaml_parsing.Unit_info.t option
val get_current_unit_name : unit -> string
val imports : unit -> Merlin_utils.Misc.crcs
val import_crcs : source:string -> Merlin_utils.Misc.crcs -> unit
val is_imported_opaque : Merlin_utils.Misc.modname -> bool
val register_import_as_opaque : Merlin_utils.Misc.modname -> unit
val keep_only_summary : Ocaml_typing.Env.t -> Ocaml_typing.Env.t
val update_short_paths : Ocaml_typing.Env.t -> Ocaml_typing.Env.t
exception Error of Ocaml_typing.Env.error
val in_signature : bool -> Ocaml_typing.Env.t -> Ocaml_typing.Env.t
val is_in_signature : Ocaml_typing.Env.t -> bool
val set_value_used_callback : Ocaml_typing.Types.value_description -> (unit -> unit) -> unit
val set_type_used_callback : Ocaml_typing.Types.type_declaration -> ((unit -> unit) -> unit) -> unit
val check_functor_application : (errors:bool -> loc:Ocaml_parsing.Location.t -> lid_whole_app:Ocaml_parsing.Longident.t -> f0_path:Ocaml_typing.Path.t -> args:(Ocaml_typing.Path.t * Ocaml_typing.Types.module_type) list -> arg_path:Ocaml_typing.Path.t -> arg_mty:Ocaml_typing.Types.module_type -> param_mty:Ocaml_typing.Types.module_type -> Ocaml_typing.Env.t -> unit) Stdlib.ref
val check_well_formed_module : (Ocaml_typing.Env.t -> Ocaml_parsing.Location.t -> string -> Ocaml_typing.Types.module_type -> unit) Stdlib.ref
val add_delayed_check_forward : ((unit -> unit) -> unit) Stdlib.ref

Folds

Folding over all identifiers (for analysis purpose)

val fold_values : (string -> Ocaml_typing.Path.t -> Ocaml_typing.Types.value_description -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val fold_types : (string -> Ocaml_typing.Path.t -> Ocaml_typing.Types.type_declaration -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val fold_constructors : (Ocaml_typing.Data_types.constructor_description -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val fold_labels : (Ocaml_typing.Data_types.label_description -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val fold_modules : (string -> Ocaml_typing.Path.t -> Ocaml_typing.Types.module_declaration -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a

Persistent structures are only traversed if they are already loaded.

val fold_modtypes : (string -> Ocaml_typing.Path.t -> Ocaml_typing.Types.modtype_declaration -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val fold_classes : (string -> Ocaml_typing.Path.t -> Ocaml_typing.Types.class_declaration -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val fold_cltypes : (string -> Ocaml_typing.Path.t -> Ocaml_typing.Types.class_type_declaration -> 'a -> 'a) -> Ocaml_parsing.Longident.t option -> Ocaml_typing.Env.t -> 'a -> 'a
val check_value_name : string -> Ocaml_parsing.Location.t -> unit
val print_address : Stdlib.Format.formatter -> Ocaml_typing.Env.address -> unit
val unbound_class : Ocaml_typing.Path.t

merlin: manage internal state

val check_state_consistency : unit -> bool
val with_cmis : (unit -> 'a) -> 'a
val cleanup_functor_caches : stamp:int -> unit
val cleanup_usage_tables : stamp:int -> unit