package ocaml-base-compiler

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val register_uid : Types.Uid.t -> Location.t -> unit
val get_uid_to_loc_tbl : unit -> Location.t Types.Uid.Tbl.t
type value_unbound_reason =
  1. | Val_unbound_instance_variable
  2. | Val_unbound_self
  3. | Val_unbound_ancestor
  4. | Val_unbound_ghost_recursive of Location.t
type module_unbound_reason =
  1. | Mod_unbound_illegal_recursion
type summary =
  1. | Env_empty
  2. | Env_value of summary * Ident.t * Types.value_description
  3. | Env_type of summary * Ident.t * Types.type_declaration
  4. | Env_extension of summary * Ident.t * Types.extension_constructor
  5. | Env_module of summary * Ident.t * Types.module_presence * Types.module_declaration
  6. | Env_modtype of summary * Ident.t * Types.modtype_declaration
  7. | Env_class of summary * Ident.t * Types.class_declaration
  8. | Env_cltype of summary * Ident.t * Types.class_type_declaration
  9. | Env_open of summary * Path.t
    (*

    The string set argument of Env_open represents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.

    *)
  10. | Env_functor_arg of summary * Ident.t
  11. | Env_constraints of summary * Types.type_declaration Path.Map.t
  12. | Env_copy_types of summary
  13. | Env_persistent of summary * Ident.t
  14. | Env_value_unbound of summary * string * value_unbound_reason
  15. | Env_module_unbound of summary * string * module_unbound_reason
type address =
  1. | Aident of Ident.t
  2. | Adot of address * int
type t
val empty : t
val initial : t
val diff : t -> t -> Ident.t list
type type_descriptions = type_descr_kind
type iter_cont
val iter_types : (Path.t -> (Path.t * Types.type_declaration) -> unit) -> t -> iter_cont
val run_iter_cont : iter_cont list -> (Path.t * iter_cont) list
val same_types : t -> t -> bool
val used_persistent : unit -> Misc.Stdlib.String.Set.t
val find_shadowed_types : Path.t -> t -> Path.t list
val without_cmis : ('a -> 'b) -> 'a -> 'b
val find_value : Path.t -> t -> Types.value_description
val find_type : Path.t -> t -> Types.type_declaration
val find_type_descrs : Path.t -> t -> type_descriptions
val find_module : Path.t -> t -> Types.module_declaration
val find_modtype : Path.t -> t -> Types.modtype_declaration
val find_class : Path.t -> t -> Types.class_declaration
val find_cltype : Path.t -> t -> Types.class_type_declaration
val find_strengthened_module : aliasable:bool -> Path.t -> t -> Types.module_type
val find_ident_constructor : Ident.t -> t -> Types.constructor_description
val find_ident_label : Ident.t -> t -> Types.label_description
val find_type_expansion : Path.t -> t -> Types.type_expr list * Types.type_expr * int
val find_type_expansion_opt : Path.t -> t -> Types.type_expr list * Types.type_expr * int
val find_modtype_expansion : Path.t -> t -> Types.module_type
val find_modtype_expansion_lazy : Path.t -> t -> Subst.Lazy.modtype
val find_hash_type : Path.t -> t -> Types.type_declaration
val find_value_address : Path.t -> t -> address
val find_module_address : Path.t -> t -> address
val find_class_address : Path.t -> t -> address
val find_constructor_address : Path.t -> t -> address
val shape_of_path : namespace:Shape.Sig_component_kind.t -> t -> Path.t -> Shape.t
val add_functor_arg : Ident.t -> t -> t
val is_functor_arg : Path.t -> t -> bool
val normalize_module_path : Location.t option -> t -> Path.t -> Path.t
val normalize_type_path : Location.t option -> t -> Path.t -> Path.t
val normalize_value_path : Location.t option -> t -> Path.t -> Path.t
val normalize_modtype_path : t -> Path.t -> Path.t
val reset_required_globals : unit -> unit
val get_required_globals : unit -> Ident.t list
val add_required_global : Ident.t -> unit
val has_local_constraints : t -> bool
val mark_value_used : Types.Uid.t -> unit
val mark_module_used : Types.Uid.t -> unit
val mark_type_used : Types.Uid.t -> unit
type constructor_usage =
  1. | Positive
  2. | Pattern
  3. | Exported_private
  4. | Exported
val mark_constructor_used : constructor_usage -> Types.constructor_declaration -> unit
val mark_extension_used : constructor_usage -> Types.extension_constructor -> unit
type label_usage =
  1. | Projection
  2. | Mutation
  3. | Construct
  4. | Exported_private
  5. | Exported
val mark_label_used : label_usage -> Types.label_declaration -> unit
type unbound_value_hint =
  1. | No_hint
  2. | Missing_rec of Location.t
type lookup_error =
  1. | Unbound_value of Longident.t * unbound_value_hint
  2. | Unbound_type of Longident.t
  3. | Unbound_constructor of Longident.t
  4. | Unbound_label of Longident.t
  5. | Unbound_module of Longident.t
  6. | Unbound_class of Longident.t
  7. | Unbound_modtype of Longident.t
  8. | Unbound_cltype of Longident.t
  9. | Unbound_instance_variable of string
  10. | Not_an_instance_variable of string
  11. | Masked_instance_variable of Longident.t
  12. | Masked_self_variable of Longident.t
  13. | Masked_ancestor_variable of Longident.t
  14. | Structure_used_as_functor of Longident.t
  15. | Abstract_used_as_functor of Longident.t
  16. | Functor_used_as_structure of Longident.t
  17. | Abstract_used_as_structure of Longident.t
  18. | Generative_used_as_applicative of Longident.t
  19. | Illegal_reference_to_recursive_module
  20. | Cannot_scrape_alias of Longident.t * Path.t
val lookup_error : Location.t -> t -> lookup_error -> 'a
val lookup_value : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t * Types.value_description
val lookup_type : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t * Types.type_declaration
val lookup_module : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t * Types.module_declaration
val lookup_modtype : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t * Types.modtype_declaration
val lookup_class : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t * Types.class_declaration
val lookup_cltype : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t * Types.class_type_declaration
val lookup_module_path : ?use:bool -> loc:Location.t -> load:bool -> Longident.t -> t -> Path.t
val lookup_modtype_path : ?use:bool -> loc:Location.t -> Longident.t -> t -> Path.t
val lookup_constructor : ?use:bool -> loc:Location.t -> constructor_usage -> Longident.t -> t -> Types.constructor_description
val lookup_all_constructors : ?use:bool -> loc:Location.t -> constructor_usage -> Longident.t -> t -> ((Types.constructor_description * (unit -> unit)) list, Location.t * t * lookup_error) result
val lookup_all_constructors_from_type : ?use:bool -> loc:Location.t -> constructor_usage -> Path.t -> t -> (Types.constructor_description * (unit -> unit)) list
val lookup_label : ?use:bool -> loc:Location.t -> label_usage -> Longident.t -> t -> Types.label_description
val lookup_all_labels : ?use:bool -> loc:Location.t -> label_usage -> Longident.t -> t -> ((Types.label_description * (unit -> unit)) list, Location.t * t * lookup_error) result
val lookup_all_labels_from_type : ?use:bool -> loc:Location.t -> label_usage -> Path.t -> t -> (Types.label_description * (unit -> unit)) list
val lookup_instance_variable : ?use:bool -> loc:Location.t -> string -> t -> Path.t * Asttypes.mutable_flag * string * Types.type_expr
val find_value_by_name : Longident.t -> t -> Path.t * Types.value_description
val find_type_by_name : Longident.t -> t -> Path.t * Types.type_declaration
val find_module_by_name : Longident.t -> t -> Path.t * Types.module_declaration
val find_modtype_by_name : Longident.t -> t -> Path.t * Types.modtype_declaration
val find_class_by_name : Longident.t -> t -> Path.t * Types.class_declaration
val find_cltype_by_name : Longident.t -> t -> Path.t * Types.class_type_declaration
val find_constructor_by_name : Longident.t -> t -> Types.constructor_description
val find_label_by_name : Longident.t -> t -> Types.label_description
val find_value_index : Ident.t -> 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 : Ident.t -> t -> int option
val find_module_index : Ident.t -> t -> int option
val find_modtype_index : Ident.t -> t -> int option
val find_class_index : Ident.t -> t -> int option
val find_cltype_index : Ident.t -> t -> int option
val bound_value : string -> t -> bool
val bound_module : string -> t -> bool
val bound_type : string -> t -> bool
val bound_modtype : string -> t -> bool
val bound_class : string -> t -> bool
val bound_cltype : string -> t -> bool
val make_copy_of_types : t -> t -> t
val add_value : ?check:(string -> Warnings.t) -> Ident.t -> Types.value_description -> t -> t
val add_type : check:bool -> Ident.t -> Types.type_declaration -> t -> t
val add_extension : check:bool -> rebind:bool -> Ident.t -> Types.extension_constructor -> t -> t
val add_module : ?arg:bool -> ?shape:Shape.t -> Ident.t -> Types.module_presence -> Types.module_type -> t -> t
val add_module_lazy : update_summary:bool -> Ident.t -> Types.module_presence -> Subst.Lazy.modtype -> t -> t
val add_module_declaration : ?arg:bool -> ?shape:Shape.t -> check:bool -> Ident.t -> Types.module_presence -> Types.module_declaration -> t -> t
val add_module_declaration_lazy : update_summary:bool -> Ident.t -> Types.module_presence -> Subst.Lazy.module_decl -> t -> t
val add_modtype : Ident.t -> Types.modtype_declaration -> t -> t
val add_modtype_lazy : update_summary:bool -> Ident.t -> Subst.Lazy.modtype_declaration -> t -> t
val add_class : Ident.t -> Types.class_declaration -> t -> t
val add_cltype : Ident.t -> Types.class_type_declaration -> t -> t
val add_local_type : Path.t -> Types.type_declaration -> t -> t
val add_persistent_structure : Ident.t -> t -> t
val persistent_structures_of_dir : Load_path.Dir.t -> Misc.Stdlib.String.Set.t
val filter_non_loaded_persistent : (Ident.t -> bool) -> t -> t
val add_signature : Types.signature -> t -> t
val open_signature : ?used_slot:bool ref -> ?loc:Location.t -> ?toplevel:bool -> Asttypes.override_flag -> Path.t -> t -> (t, [ `Not_found | `Functor ]) result
val open_pers_signature : string -> t -> (t, [ `Not_found ]) result
val remove_last_open : Path.t -> t -> t option
val enter_value : ?check:(string -> Warnings.t) -> string -> Types.value_description -> t -> Ident.t * t
val enter_type : scope:int -> string -> Types.type_declaration -> t -> Ident.t * t
val enter_extension : scope:int -> rebind:bool -> string -> Types.extension_constructor -> t -> Ident.t * t
val enter_module : scope:int -> ?arg:bool -> string -> Types.module_presence -> Types.module_type -> t -> Ident.t * t
val enter_module_declaration : scope:int -> ?arg:bool -> ?shape:Shape.t -> string -> Types.module_presence -> Types.module_declaration -> t -> Ident.t * t
val enter_modtype : scope:int -> string -> Types.modtype_declaration -> t -> Ident.t * t
val enter_class : scope:int -> string -> Types.class_declaration -> t -> Ident.t * t
val enter_cltype : scope:int -> string -> Types.class_type_declaration -> t -> Ident.t * t
val enter_signature : ?mod_shape:Shape.t -> scope:int -> Types.signature -> t -> Types.signature * t
val enter_signature_and_shape : scope:int -> parent_shape:Shape.Map.t -> Shape.t -> Types.signature -> t -> Types.signature * Shape.Map.t * t
val enter_unbound_value : string -> value_unbound_reason -> t -> t
val enter_unbound_module : string -> module_unbound_reason -> t -> t
val reset_cache : unit -> unit
val reset_cache_toplevel : unit -> unit
val set_unit_name : string -> unit
val get_unit_name : unit -> string
val read_signature : Misc.modname -> Misc.filepath -> Types.signature
val save_signature_with_imports : alerts:Misc.alerts -> Types.signature -> Misc.modname -> Misc.filepath -> Misc.crcs -> Cmi_format.cmi_infos
val crc_of_unit : Misc.modname -> Digest.t
val imports : unit -> Misc.crcs
val import_crcs : source:string -> Misc.crcs -> unit
val is_imported_opaque : Misc.modname -> bool
val register_import_as_opaque : Misc.modname -> unit
val summary : t -> summary
val keep_only_summary : t -> t
val env_of_only_summary : (summary -> Subst.t -> t) -> t -> t
type error =
  1. | Missing_module of Location.t * Path.t * Path.t
  2. | Illegal_value_name of Location.t * string
  3. | Lookup_error of Location.t * t * lookup_error
exception Error of error
val report_error : Format.formatter -> error -> unit
val report_lookup_error : Location.t -> t -> Format.formatter -> lookup_error -> unit
val in_signature : bool -> t -> t
val is_in_signature : t -> bool
val set_value_used_callback : Types.value_description -> (unit -> unit) -> unit
val set_type_used_callback : Types.type_declaration -> ((unit -> unit) -> unit) -> unit
val check_functor_application : (errors:bool -> loc:Location.t -> lid_whole_app:Longident.t -> f0_path:Path.t -> args:(Path.t * Types.module_type) list -> arg_path:Path.t -> arg_mty:Types.module_type -> param_mty:Types.module_type -> t -> unit) ref
val check_well_formed_module : (t -> Location.t -> string -> Types.module_type -> unit) ref
val add_delayed_check_forward : ((unit -> unit) -> unit) ref
val strengthen : (aliasable:bool -> t -> Subst.Lazy.modtype -> Path.t -> Subst.Lazy.modtype) ref
val same_constr : (t -> Types.type_expr -> Types.type_expr -> bool) ref
val print_longident : (Format.formatter -> Longident.t -> unit) ref
val print_path : (Format.formatter -> Path.t -> unit) ref

Folds

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

Persistent structures are only traversed if they are already loaded.

val fold_modtypes : (string -> Path.t -> Types.modtype_declaration -> 'a -> 'a) -> Longident.t option -> t -> 'a -> 'a
val fold_classes : (string -> Path.t -> Types.class_declaration -> 'a -> 'a) -> Longident.t option -> t -> 'a -> 'a
val fold_cltypes : (string -> Path.t -> Types.class_type_declaration -> 'a -> 'a) -> Longident.t option -> t -> 'a -> 'a
val scrape_alias : t -> Types.module_type -> Types.module_type

Utilities

val check_value_name : string -> Location.t -> unit
val print_address : Format.formatter -> address -> unit