Module Melange_compiler_libs.Env

let register_uid: Shape.Uid.t => Location.t => unit;
let get_uid_to_loc_tbl: unit => Shape.Uid.Tbl.t(Location.t);
type value_unbound_reason =
  1. | Val_unbound_instance_variable
  2. | Val_unbound_self
  3. | Val_unbound_ancestor
  4. | Val_unbound_ghost_recursive(Location.t)
;
type module_unbound_reason =
  1. | Mod_unbound_illegal_recursion
;
type summary =
  1. | Env_empty
  2. | Env_value(summary, Ident.t, Types.value_description)
  3. | Env_type(summary, Ident.t, Types.type_declaration)
  4. | Env_extension(summary, Ident.t, Types.extension_constructor)
  5. | Env_module(summary, Ident.t, Types.module_presence, Types.module_declaration)
  6. | Env_modtype(summary, Ident.t, Types.modtype_declaration)
  7. | Env_class(summary, Ident.t, Types.class_declaration)
  8. | Env_cltype(summary, Ident.t, Types.class_type_declaration)
  9. | Env_open(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(summary, Ident.t)
  11. | Env_copy_types(summary)
  12. | Env_persistent(summary, Ident.t)
  13. | Env_value_unbound(summary, string, value_unbound_reason)
  14. | Env_module_unbound(summary, string, module_unbound_reason)
;
type address =
  1. | Aident(Ident.t)
  2. | Adot(address, int)
;
type t;
let empty: t;
let initial: t;
let diff: t => t => list(Ident.t);
type type_descriptions = type_descr_kind;
type iter_cont;
let iter_types: (Path.t => (Path.t, Types.type_declaration) => unit) => t => iter_cont;
let run_iter_cont: list(iter_cont) => list((Path.t, iter_cont));
let same_types: t => t => bool;
let used_persistent: unit => Melange_compiler_libs__.Misc.Stdlib.String.Set.t;
let find_shadowed_types: Path.t => t => list(Path.t);
let without_cmis: ('a => 'b) => 'a => 'b;
let find_value: Path.t => t => Types.value_description;
let find_type: Path.t => t => Types.type_declaration;
let find_type_descrs: Path.t => t => type_descriptions;
let find_module: Path.t => t => Types.module_declaration;
let find_modtype: Path.t => t => Types.modtype_declaration;
let find_class: Path.t => t => Types.class_declaration;
let find_cltype: Path.t => t => Types.class_type_declaration;
let find_strengthened_module: aliasable:bool => Path.t => t => Types.module_type;
let find_ident_constructor: Ident.t => t => Types.constructor_description;
let find_ident_label: Ident.t => t => Types.label_description;
let find_type_expansion: Path.t => t => (list(Types.type_expr), Types.type_expr, int);
let find_type_expansion_opt: Path.t => t => (list(Types.type_expr), Types.type_expr, int);
let find_modtype_expansion: Path.t => t => Types.module_type;
let find_modtype_expansion_lazy: Path.t => t => Subst.Lazy.modtype;
let find_hash_type: Path.t => t => Types.type_declaration;
let find_value_address: Path.t => t => address;
let find_module_address: Path.t => t => address;
let find_class_address: Path.t => t => address;
let find_constructor_address: Path.t => t => address;
let shape_of_path: namespace:Shape.Sig_component_kind.t => t => Path.t => Shape.t;
let add_functor_arg: Ident.t => t => t;
let is_functor_arg: Path.t => t => bool;
let normalize_module_path: option(Location.t) => t => Path.t => Path.t;
let normalize_type_path: option(Location.t) => t => Path.t => Path.t;
let normalize_value_path: option(Location.t) => t => Path.t => Path.t;
let normalize_modtype_path: t => Path.t => Path.t;
let reset_required_globals: unit => unit;
let get_required_globals: unit => list(Ident.t);
let add_required_global: Ident.t => unit;
let has_local_constraints: t => bool;
let mark_value_used: Shape.Uid.t => unit;
let mark_module_used: Shape.Uid.t => unit;
let mark_type_used: Shape.Uid.t => unit;
type constructor_usage =
  1. | Positive
  2. | Pattern
  3. | Exported_private
  4. | Exported
;
let mark_constructor_used: constructor_usage => Types.constructor_declaration => unit;
let mark_extension_used: constructor_usage => Types.extension_constructor => unit;
type label_usage =
  1. | Projection
  2. | Mutation
  3. | Construct
  4. | Exported_private
  5. | Exported
;
let mark_label_used: label_usage => Types.label_declaration => unit;
type unbound_value_hint =
  1. | No_hint
  2. | Missing_rec(Location.t)
;
type lookup_error =
  1. | Unbound_value(Longident.t, unbound_value_hint)
  2. | Unbound_type(Longident.t)
  3. | Unbound_constructor(Longident.t)
  4. | Unbound_label(Longident.t)
  5. | Unbound_module(Longident.t)
  6. | Unbound_class(Longident.t)
  7. | Unbound_modtype(Longident.t)
  8. | Unbound_cltype(Longident.t)
  9. | Unbound_instance_variable(string)
  10. | Not_an_instance_variable(string)
  11. | Masked_instance_variable(Longident.t)
  12. | Masked_self_variable(Longident.t)
  13. | Masked_ancestor_variable(Longident.t)
  14. | Structure_used_as_functor(Longident.t)
  15. | Abstract_used_as_functor(Longident.t)
  16. | Functor_used_as_structure(Longident.t)
  17. | Abstract_used_as_structure(Longident.t)
  18. | Generative_used_as_applicative(Longident.t)
  19. | Illegal_reference_to_recursive_module
  20. | Cannot_scrape_alias(Longident.t, Path.t)
;
let lookup_error: Location.t => t => lookup_error => 'a;
let lookup_value: ?use:bool => loc:Location.t => Longident.t => t => (Path.t, Types.value_description);
let lookup_type: ?use:bool => loc:Location.t => Longident.t => t => (Path.t, Types.type_declaration);
let lookup_module: ?use:bool => loc:Location.t => Longident.t => t => (Path.t, Types.module_declaration);
let lookup_modtype: ?use:bool => loc:Location.t => Longident.t => t => (Path.t, Types.modtype_declaration);
let lookup_class: ?use:bool => loc:Location.t => Longident.t => t => (Path.t, Types.class_declaration);
let lookup_cltype: ?use:bool => loc:Location.t => Longident.t => t => (Path.t, Types.class_type_declaration);
let lookup_module_path: ?use:bool => loc:Location.t => load:bool => Longident.t => t => Path.t;
let lookup_modtype_path: ?use:bool => loc:Location.t => Longident.t => t => Path.t;
let lookup_constructor: ?use:bool => loc:Location.t => constructor_usage => Longident.t => t => Types.constructor_description;
let lookup_all_constructors: ?use:bool => loc:Location.t => constructor_usage => Longident.t => t => Stdlib.result(list((Types.constructor_description, (unit => unit))), (Location.t, t, lookup_error));
let lookup_all_constructors_from_type: ?use:bool => loc:Location.t => constructor_usage => Path.t => t => list((Types.constructor_description, (unit => unit)));
let lookup_label: ?use:bool => loc:Location.t => label_usage => Longident.t => t => Types.label_description;
let lookup_all_labels: ?use:bool => loc:Location.t => label_usage => Longident.t => t => Stdlib.result(list((Types.label_description, (unit => unit))), (Location.t, t, lookup_error));
let lookup_all_labels_from_type: ?use:bool => loc:Location.t => label_usage => Path.t => t => list((Types.label_description, (unit => unit)));
let lookup_instance_variable: ?use:bool => loc:Location.t => string => t => (Path.t, Asttypes.mutable_flag, string, Types.type_expr);
let find_value_by_name: Longident.t => t => (Path.t, Types.value_description);
let find_type_by_name: Longident.t => t => (Path.t, Types.type_declaration);
let find_module_by_name: Longident.t => t => (Path.t, Types.module_declaration);
let find_modtype_by_name: Longident.t => t => (Path.t, Types.modtype_declaration);
let find_class_by_name: Longident.t => t => (Path.t, Types.class_declaration);
let find_cltype_by_name: Longident.t => t => (Path.t, Types.class_type_declaration);
let find_constructor_by_name: Longident.t => t => Types.constructor_description;
let find_label_by_name: Longident.t => t => Types.label_description;
let find_value_index: Ident.t => t => option(int);

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.

let find_type_index: Ident.t => t => option(int);
let find_module_index: Ident.t => t => option(int);
let find_modtype_index: Ident.t => t => option(int);
let find_class_index: Ident.t => t => option(int);
let find_cltype_index: Ident.t => t => option(int);
let bound_value: string => t => bool;
let bound_module: string => t => bool;
let bound_type: string => t => bool;
let bound_modtype: string => t => bool;
let bound_class: string => t => bool;
let bound_cltype: string => t => bool;
let make_copy_of_types: t => t => t;
let add_value: ?check:(string => Warnings.t) => Ident.t => Types.value_description => t => t;
let add_type: check:bool => Ident.t => Types.type_declaration => t => t;
let add_extension: check:bool => rebind:bool => Ident.t => Types.extension_constructor => t => t;
let add_module: ?arg:bool => ?shape:Shape.t => Ident.t => Types.module_presence => Types.module_type => t => t;
let add_module_lazy: update_summary:bool => Ident.t => Types.module_presence => Subst.Lazy.modtype => t => t;
let add_module_declaration: ?arg:bool => ?shape:Shape.t => check:bool => Ident.t => Types.module_presence => Types.module_declaration => t => t;
let add_module_declaration_lazy: update_summary:bool => Ident.t => Types.module_presence => Subst.Lazy.module_decl => t => t;
let add_modtype: Ident.t => Types.modtype_declaration => t => t;
let add_modtype_lazy: update_summary:bool => Ident.t => Subst.Lazy.modtype_declaration => t => t;
let add_class: Ident.t => Types.class_declaration => t => t;
let add_cltype: Ident.t => Types.class_type_declaration => t => t;
let add_local_type: Path.t => Types.type_declaration => t => t;
let add_persistent_structure: Ident.t => t => t;
let persistent_structures_of_dir: Load_path.Dir.t => Melange_compiler_libs__.Misc.Stdlib.String.Set.t;
let filter_non_loaded_persistent: (Ident.t => bool) => t => t;
let add_signature: Types.signature => t => t;
let open_signature: ?used_slot:Stdlib.ref(bool) => ?loc:Location.t => ?toplevel:bool => Asttypes.override_flag => Path.t => t => Stdlib.result(t, [ `Not_found | `Functor ]);
let open_pers_signature: string => t => Stdlib.result(t, [ `Not_found ]);
let remove_last_open: Path.t => t => option(t);
let enter_value: ?check:(string => Warnings.t) => string => Types.value_description => t => (Ident.t, t);
let enter_type: scope:int => string => Types.type_declaration => t => (Ident.t, t);
let enter_extension: scope:int => rebind:bool => string => Types.extension_constructor => t => (Ident.t, t);
let enter_module: scope:int => ?arg:bool => string => Types.module_presence => Types.module_type => t => (Ident.t, t);
let enter_module_declaration: scope:int => ?arg:bool => ?shape:Shape.t => string => Types.module_presence => Types.module_declaration => t => (Ident.t, t);
let enter_modtype: scope:int => string => Types.modtype_declaration => t => (Ident.t, t);
let enter_class: scope:int => string => Types.class_declaration => t => (Ident.t, t);
let enter_cltype: scope:int => string => Types.class_type_declaration => t => (Ident.t, t);
let enter_signature: ?mod_shape:Shape.t => scope:int => Types.signature => t => (Types.signature, t);
let enter_signature_and_shape: scope:int => parent_shape:Shape.Map.t => Shape.t => Types.signature => t => (Types.signature, Shape.Map.t, t);
let enter_unbound_value: string => value_unbound_reason => t => t;
let enter_unbound_module: string => module_unbound_reason => t => t;
let reset_cache: unit => unit;
let reset_cache_toplevel: unit => unit;
let set_unit_name: string => unit;
let get_unit_name: unit => string;
let read_signature: Misc.modname => Misc.filepath => Types.signature;
let save_signature: ?check_exists:unit => alerts:Misc.alerts => Types.signature => Misc.modname => Misc.filepath => Cmi_format.cmi_infos;
let save_signature_with_imports: ?check_exists:unit => alerts:Misc.alerts => Types.signature => Misc.modname => Misc.filepath => Misc.crcs => Cmi_format.cmi_infos;
let crc_of_unit: Misc.modname => Stdlib.Digest.t;
let imports: unit => Misc.crcs;
let import_crcs: source:string => Misc.crcs => unit;
let is_imported_opaque: Misc.modname => bool;
let register_import_as_opaque: Misc.modname => unit;
let summary: t => summary;
let keep_only_summary: t => t;
let env_of_only_summary: (summary => Subst.t => t) => t => t;
type error =
  1. | Missing_module(Location.t, Path.t, Path.t)
  2. | Illegal_value_name(Location.t, string)
  3. | Lookup_error(Location.t, t, lookup_error)
;
exception Error(error);
let report_error: Stdlib.Format.formatter => error => unit;
let report_lookup_error: Location.t => t => Stdlib.Format.formatter => lookup_error => unit;
let in_signature: bool => t => t;
let is_in_signature: t => bool;
let set_value_used_callback: Types.value_description => (unit => unit) => unit;
let set_type_used_callback: Types.type_declaration => ((unit => unit) => unit) => unit;
let check_functor_application: Stdlib.ref((errors:bool => loc:Location.t => lid_whole_app:Longident.t => f0_path:Path.t => args:list((Path.t, Types.module_type)) => arg_path:Path.t => arg_mty:Types.module_type => param_mty:Types.module_type => t => unit));
let check_well_formed_module: Stdlib.ref((t => Location.t => string => Types.module_type => unit));
let add_delayed_check_forward: Stdlib.ref(((unit => unit) => unit));
let strengthen: Stdlib.ref((aliasable:bool => t => Subst.Lazy.modtype => Path.t => Subst.Lazy.modtype));
let same_constr: Stdlib.ref((t => Types.type_expr => Types.type_expr => bool));
let print_longident: Stdlib.ref((Stdlib.Format.formatter => Longident.t => unit));
let print_path: Stdlib.ref((Stdlib.Format.formatter => Path.t => unit));

Folds

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

Persistent structures are only traversed if they are already loaded.

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

Utilities

let check_value_name: string => Location.t => unit;
let print_address: Stdlib.Format.formatter => address => unit;