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 =
| Val_unbound_instance_variable
| Val_unbound_self
| Val_unbound_ancestor
| Val_unbound_ghost_recursive(Location.t)
;
type summary =
| Env_empty
| Env_value(summary, Ident.t, Types.value_description)
| Env_type(summary, Ident.t, Types.type_declaration)
| Env_extension(summary, Ident.t, Types.extension_constructor)
| Env_module(summary, Ident.t, Types.module_presence, Types.module_declaration)
| Env_modtype(summary, Ident.t, Types.modtype_declaration)
| Env_class(summary, Ident.t, Types.class_declaration)
| Env_cltype(summary, Ident.t, Types.class_type_declaration)
| 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.
| Env_functor_arg(summary, Ident.t)
| Env_copy_types(summary)
| Env_persistent(summary, Ident.t)
| Env_value_unbound(summary, string, value_unbound_reason)
| Env_module_unbound(summary, string, module_unbound_reason)
;
let empty: t;
let initial: t;
type type_descr_kind =
Types.type_kind(Types.label_description, Types.constructor_description);
type type_descriptions = type_descr_kind;
let iter_types:
(Path.t => (Path.t, Types.type_declaration) => unit) =>
t =>
iter_cont;
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 shape_of_path:
namespace:Shape.Sig_component_kind.t =>
t =>
Path.t =>
Shape.t;
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 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;
let mark_constructor_used:
constructor_usage =>
Types.constructor_declaration =>
unit;
let mark_extension_used:
constructor_usage =>
Types.extension_constructor =>
unit;
let mark_label_used: label_usage => Types.label_declaration => unit;
type lookup_error =
| Unbound_value(Longident.t, unbound_value_hint)
| Unbound_type(Longident.t)
| Unbound_constructor(Longident.t)
| Unbound_label(Longident.t)
| Unbound_module(Longident.t)
| Unbound_class(Longident.t)
| Unbound_modtype(Longident.t)
| Unbound_cltype(Longident.t)
| Unbound_instance_variable(string)
| Not_an_instance_variable(string)
| Masked_instance_variable(Longident.t)
| Masked_self_variable(Longident.t)
| Masked_ancestor_variable(Longident.t)
| Structure_used_as_functor(Longident.t)
| Abstract_used_as_functor(Longident.t)
| Functor_used_as_structure(Longident.t)
| Abstract_used_as_structure(Longident.t)
| Generative_used_as_applicative(Longident.t)
| Illegal_reference_to_recursive_module
| 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 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 persistent_structures_of_dir:
Load_path.Dir.t =>
Melange_compiler_libs__.Misc.Stdlib.String.Set.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 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 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;
type error =
| Missing_module(Location.t, Path.t, Path.t)
| Illegal_value_name(Location.t, string)
| 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 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 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_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;