Module Ocaml_typing.EnvSource
type value_unbound_reason = | Val_unbound_instance_variable| Val_unbound_self| Val_unbound_ancestor| Val_unbound_ghost_recursive of Ocaml_parsing.Location.t
type summary = | Env_empty| Env_value of summary * Ident.t * Types.value_description * Mode.Value.l| Env_type of summary * Ident.t * Types.type_declaration| Env_extension of summary * Ident.t * Types.extension_constructor| Env_module of summary * Ident.t * Types.module_presence * Types.module_declaration * Mode.Value.l * locks| Env_modtype of summary * Ident.t * Types.modtype_declaration| Env_class of summary * Ident.t * Types.class_declaration| Env_cltype of summary * Ident.t * Types.class_type_declaration| Env_open of summary * Path.t(*The string set argument of
*)Env_openrepresents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.| Env_functor_arg of summary * Ident.t| Env_constraints of summary * Types.type_declaration StagedPath.Map.t| Env_copy_types of summary| Env_persistent of summary * Ident.t| Env_value_unbound of summary * string * value_unbound_reason| Env_module_unbound of summary * string * module_unbound_reason| Env_jkind of summary * Ident.t * Types.jkind_declaration
type address = Persistent_env.address = | Aunit of Compilation_unit.t| Alocal of Ident.t| Adot of address * Jkind_types.Sort.t array * int
type type_descr_kind =
(Types.label_description,
Types.unboxed_label_description,
Types.constructor_description)
Types.type_kindFind a value by an Ident.t. Raises if encounters any locks.
val find_ident_label :
'rcd Types.record_form ->
Ident.t ->
t ->
'rcd Types.gen_label_descriptionval loaded_transitive_dependencies :
Compilation_unit.Name.Set.t ->
Compilation_unit.Name.Set.tSometimes we get the locks for something, but either want to walk them later, or walk them for something else. The Longident.t and Location.t are only for error messages, and point to the variable for which we actually want to walk the locks.
type no_open_quotations_context = | Object_qt| Struct_qt| Sig_qt| Open_qt| Object_field_with_attribute_qt| Variant_tag_with_attribute_qt| Jkind_annotation_qt| Layout_polymorphism_qt| Tconst_pat_qt of Ocaml_parsing.Longident.t| Class_type_qt
type lookup_error = | Unbound_value of Ocaml_parsing.Longident.t * unbound_value_hint| Unbound_type of Ocaml_parsing.Longident.t| Unbound_constructor of Ocaml_parsing.Longident.t| Unbound_label of Ocaml_parsing.Longident.t * Types.record_form_packed * label_usage| Unbound_module of Ocaml_parsing.Longident.t| Unbound_class of Ocaml_parsing.Longident.t| Unbound_modtype of Ocaml_parsing.Longident.t| Unbound_cltype of Ocaml_parsing.Longident.t| Unbound_jkind of Ocaml_parsing.Longident.t| Unbound_settable_variable of string| Not_a_settable_variable of string| Masked_instance_variable of Ocaml_parsing.Longident.t| Masked_self_variable of Ocaml_parsing.Longident.t| Masked_ancestor_variable of Ocaml_parsing.Longident.t| Structure_used_as_functor of Ocaml_parsing.Longident.t| Abstract_used_as_functor of Ocaml_parsing.Longident.t * Path.t| Functor_used_as_structure of Ocaml_parsing.Longident.t * structure_components_reason| Abstract_used_as_structure of Ocaml_parsing.Longident.t * Path.t * structure_components_reason| Generative_used_as_applicative of Ocaml_parsing.Longident.t| Illegal_reference_to_recursive_module of {}| Illegal_reference_to_recursive_class_type of {container : string option;unbound : string;unbound_class_type : Ocaml_parsing.Longident.t;container_class_type : string;
}| Cannot_scrape_alias of Ocaml_parsing.Longident.t * Path.t| Local_value_used_in_exclave of Ocaml_typing.Mode.Hint.lock_item * Ocaml_parsing.Longident.t| Non_value_used_in_object of Ocaml_parsing.Longident.t * Types.type_expr * Jkind.Violation.t| No_unboxed_version of Ocaml_parsing.Longident.t * Types.type_declaration| Error_from_persistent_env of Persistent_env.error| Mutable_value_used_in_closure of Ocaml_typing.Mode.Hint.pinpoint| Incompatible_stage of Ocaml_parsing.Longident.t * Ocaml_parsing.Location.t * stage * Ocaml_parsing.Location.t * stage| Unbound_in_stage of none_in_quotations_context * Ocaml_parsing.Longident.t * Ocaml_parsing.Location.t * stage * stage
val walk_locks :
env:t ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
item:Ocaml_typing.Mode.Hint.lock_item ->
Types.type_expr option ->
mode_with_locks ->
Mode.Value.lTakes the mode and the type of a value at definition site, walks through the list of locks and constrains the mode and the type. Return the access mode of the value allowed by the locks. ty is optional as the function works on modules and classes as well, for which ty should be None.
val lookup_value :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.value_description * mode_with_locksval lookup_type :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.type_declarationval lookup_module :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.module_declaration * mode_with_locksval lookup_modtype :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.modtype_declarationval lookup_class :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.class_declaration * Mode.Value.lval lookup_cltype :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.class_type_declarationval lookup_jkind :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.jkind_declarationval lookup_module_path :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
load:bool ->
Ocaml_parsing.Longident.t ->
t ->
Path.t * mode_with_locksval lookup_modtype_path :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
Ocaml_parsing.Longident.t ->
t ->
Path.tval lookup_module_instance_path :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
load:bool ->
Global_module.Name.t ->
t ->
Path.t * mode_with_locksval lookup_constructor :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
constructor_usage ->
Ocaml_parsing.Longident.t ->
t ->
Types.constructor_description * locksval lookup_all_constructors :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
constructor_usage ->
Ocaml_parsing.Longident.t ->
t ->
(((Types.constructor_description * locks) * (unit -> unit)) list,
Ocaml_parsing.Location.t * t * lookup_error)
resultval lookup_all_constructors_from_type :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
constructor_usage ->
Path.t ->
t ->
((Types.constructor_description * locks) * (unit -> unit)) listval lookup_label :
?use:bool ->
record_form:'rcd Types.record_form ->
loc:Ocaml_parsing.Location.t ->
label_usage ->
Ocaml_parsing.Longident.t ->
t ->
'rcd Types.gen_label_descriptionval lookup_all_labels :
?use:bool ->
record_form:'rcd Types.record_form ->
loc:Ocaml_parsing.Location.t ->
label_usage ->
Ocaml_parsing.Longident.t ->
t ->
(('rcd Types.gen_label_description * (unit -> unit)) list,
Ocaml_parsing.Location.t * t * lookup_error)
resultval lookup_all_labels_from_type :
?use:bool ->
record_form:'rcd Types.record_form ->
loc:Ocaml_parsing.Location.t ->
label_usage ->
Path.t ->
t ->
('rcd Types.gen_label_description * (unit -> unit)) listtype settable_variable = | Instance_variable of Path.t * Ocaml_parsing.Asttypes.mutable_flag * string * Types.type_expr| Mutable_variable of Ident.t * Mode.Value.r * Types.type_expr * Jkind_types.Sort.t
val lookup_settable_variable :
?use:bool ->
loc:Ocaml_parsing.Location.t ->
string ->
t ->
settable_variableFor a mutable variable, use means mark as mutated. For an instance variable, it means mark as used.
val find_value_by_name_lazy :
Ocaml_parsing.Longident.t ->
t ->
Path.t * Subst.Lazy.value_descriptionval find_module_by_name_lazy :
Ocaml_parsing.Longident.t ->
t ->
Path.t * Subst.Lazy.module_declarationval find_modtype_by_name_lazy :
Ocaml_parsing.Longident.t ->
t ->
Path.t * Subst.Lazy.modtype_declarationval find_cltype_by_name :
Ocaml_parsing.Longident.t ->
t ->
Path.t * Types.class_type_declarationval find_constructor_by_name :
Ocaml_parsing.Longident.t ->
t ->
Types.constructor_descriptionval find_label_by_name :
'rep Types.record_form ->
Ocaml_parsing.Longident.t ->
t ->
'rep Types.gen_label_descriptionThe 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 add_value_lazy :
?check:(string -> Ocaml_utils.Warnings.t) ->
mode:(Mode.allowed * 'r) Mode.Value.t ->
Ident.t ->
Subst.Lazy.value_description ->
t ->
tval add_value :
?check:(string -> Ocaml_utils.Warnings.t) ->
mode:(Mode.allowed * 'r) Mode.Value.t ->
Ident.t ->
Types.value_description ->
t ->
tval add_module :
?arg:bool ->
?shape:Shape.t ->
Ident.t ->
Types.module_presence ->
Types.module_type ->
?mode:Mode.Value.l ->
t ->
tval add_module_lazy :
update_summary:bool ->
Ident.t ->
Types.module_presence ->
Subst.Lazy.module_type ->
?mode:Mode.Value.l ->
t ->
tval add_module_declaration :
?arg:bool ->
?shape:Shape.t ->
check:bool ->
Ident.t ->
Types.module_presence ->
Types.module_declaration ->
?mode:(Mode.allowed * 'r) Mode.Value.t ->
?locks:locks ->
t ->
tval add_module_declaration_lazy :
?arg:bool ->
update_summary:bool ->
Ident.t ->
Types.module_presence ->
Subst.Lazy.module_declaration ->
?mode:(Mode.allowed * 'r) Mode.Value.t ->
?locks:locks ->
t ->
tval add_modtype_lazy :
update_summary:bool ->
Ident.t ->
Subst.Lazy.modtype_declaration ->
t ->
tval persistent_structures_of_dir :
Ocaml_utils.Load_path.Dir.t ->
Ocaml_utils.Misc.Stdlib.String.Set.tval open_signature :
used_slot:bool ref ->
loc:Ocaml_parsing.Location.t ->
toplevel:bool ->
Ocaml_parsing.Asttypes.override_flag ->
Ocaml_parsing.Longident.t Ocaml_parsing.Location.loc ->
t ->
Path.t * mode_with_locks * tval enter_value :
?check:(string -> Ocaml_utils.Warnings.t) ->
mode:(Mode.allowed * 'r) Mode.Value.t ->
string ->
Types.value_description ->
t ->
Ident.t * tval enter_extension :
scope:int ->
rebind:bool ->
string ->
Types.extension_constructor ->
t ->
Ident.t * tval enter_module :
scope:int ->
?arg:bool ->
string ->
Types.module_presence ->
Types.module_type ->
?mode:(Mode.allowed * 'r) Mode.Value.t ->
t ->
Ident.t * tval enter_module_declaration :
scope:int ->
?arg:bool ->
?shape:Shape.t ->
string ->
Types.module_presence ->
Types.module_declaration ->
?mode:(Mode.allowed * 'r) Mode.Value.t ->
?locks:locks ->
t ->
Ident.t * tval enter_signature :
?mod_shape:Shape.t ->
scope:int ->
Types.signature ->
?mode:(Mode.allowed * 'r) Mode.Value.t ->
t ->
Types.signature * tval enter_signature_and_shape :
scope:int ->
parent_shape:Shape.Map.t ->
Shape.t ->
Types.signature ->
?mode:(Mode.allowed * 'r) Mode.Value.t ->
t ->
Types.signature * Shape.Map.t * tval add_closure_lock :
Ocaml_typing.Mode.Hint.pinpoint ->
('l * Mode.allowed) Mode.Value.Comonadic.t ->
t ->
tval add_const_closure_lock :
?ghost:bool ->
Ocaml_typing.Mode.Hint.pinpoint ->
Mode.Value.Comonadic.Const.t ->
t ->
tA variant of add_closure_lock where the mode of the closure is a constant due to the nature of the pinpoint. As a result, the mode is not printed in error messages. ghost = true means the closure is not a value (such as a loop)
Set the environment's stage to a fixed one in the far future. Should only be used in cases where the stage is unknown.
val check_no_open_quotations :
Ocaml_parsing.Location.t ->
t ->
no_open_quotations_context ->
unitval read_signature :
Global_module.Name.t ->
Unit_info.Artifact.t ->
Types.persistent_signatureval save_signature :
alerts:Ocaml_utils.Misc.alerts ->
Types.persistent_signature ->
Compilation_unit.Name.t ->
Cmi_format.kind ->
Unit_info.Artifact.t ->
Cmi_format.cmi_infos_lazyval save_signature_with_imports :
alerts:Ocaml_utils.Misc.alerts ->
Types.persistent_signature ->
Compilation_unit.Name.t ->
Cmi_format.kind ->
Unit_info.Artifact.t ->
Import_info.t array ->
Cmi_format.cmi_infos_lazytype error = | Missing_module of Ocaml_parsing.Location.t * Path.t * Path.t| Illegal_value_name of Ocaml_parsing.Location.t * string| Lookup_error of Ocaml_parsing.Location.t * t * lookup_error| Incomplete_instantiation of {unset_param : Global_module.Parameter_name.t;
}| Toplevel_splice of Ocaml_parsing.Location.t| Unsupported_inside_quotation of Ocaml_parsing.Location.t * no_open_quotations_context
val report_lookup_error :
Ocaml_parsing.Location.t ->
t ->
lookup_error Ocaml_utils.Format_doc.format_printerval report_lookup_error_doc :
Ocaml_parsing.Location.t ->
t ->
lookup_error Ocaml_utils.Format_doc.printerval check_functor_application :
(errors:bool ->
loc:Ocaml_parsing.Location.t ->
lid_whole_app:Ocaml_parsing.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)
refval check_well_formed_module :
(t -> Ocaml_parsing.Location.t -> string -> Types.module_type -> unit) refval constrain_type_jkind :
(t ->
Types.type_expr ->
Types.jkind_r ->
(unit, Jkind.Violation.t) result)
refval report_jkind_violation_with_offender :
(offender:(Ocaml_utils.Format_doc.formatter -> unit) ->
t ->
Ocaml_utils.Format_doc.formatter ->
Jkind.Violation.t ->
unit)
refFolds
Folding over all identifiers (for analysis purpose)
val fold_values :
(string ->
Path.t ->
Subst.Lazy.value_description ->
Mode.Value.l ->
'a ->
'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval fold_types :
(string -> Path.t -> Types.type_declaration -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval fold_constructors :
(Types.constructor_description -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval fold_labels :
'rcd Types.record_form ->
('rcd Types.gen_label_description -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval fold_modules :
(string -> Path.t -> Subst.Lazy.module_declaration -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aPersistent structures are only traversed if they are already loaded.
val fold_modtypes :
(string -> Path.t -> Subst.Lazy.modtype_declaration -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval fold_classes :
(string -> Path.t -> Types.class_declaration -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval fold_cltypes :
(string -> Path.t -> Types.class_type_declaration -> 'a -> 'a) ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aUtilities
merlin: manage internal state
This value should be filled in with Msupport.raise_error. Env cannot use this function directly because Msupport depends on Env
type 'acc fold_all_labels_f = {fold_all_labels_f : 'rcd. 'rcd Types.record_form -> 'rcd Types.gen_label_description -> 'acc -> 'acc;
}val fold_all_labels :
'a fold_all_labels_f ->
Ocaml_parsing.Longident.t option ->
t ->
'a ->
'aval print_with_quote_promote :
Ocaml_utils.Format_doc.formatter ->
(string * stage * stage) ->
unit