Ocaml_typing.Ctypeexception Unify of Errortrace.unification_errorexception Equality of Errortrace.equality_errorexception Moregen of Errortrace.moregen_errorexception Subtype of Errortrace.Subtype.errorexception Escape of Types.type_expr Errortrace.escapeexception Tags of Ocaml_parsing.Asttypes.label * Ocaml_parsing.Asttypes.labelval save_levels : unit -> levelsval set_levels : levels -> unitval newty : Types.type_desc -> Types.type_exprval new_scoped_ty : int -> Types.type_desc -> Types.type_exprval newvar : ?name:string -> Types.jkind_lr -> Types.type_exprval new_rep_var :
?name:string ->
why:Jkind.History.concrete_creation_reason ->
unit ->
Types.type_expr * Jkind.sortval newvar2 : ?name:string -> int -> Types.jkind_lr -> Types.type_exprval new_global_var : ?name:string -> Types.jkind_lr -> Types.type_exprval newobj : Types.type_expr -> Types.type_exprval newconstr : Path.t -> Types.type_expr list -> Types.type_exprval newmono : Types.type_expr -> Types.type_exprval none : Types.type_exprval object_fields : Types.type_expr -> Types.type_exprval flatten_fields :
Types.type_expr ->
(string * Types.field_kind * Types.type_expr) list * Types.type_exprTransform a field type into a list of pairs label-type. The fields are sorted.
Beware of the interaction with GADTs:
Due to the introduction of object indexes for GADTs, the row variable of an object may now be an expansible type abbreviation. A first consequence is that flatten_fields will not completely flatten the object, since the type abbreviation will not be expanded (flatten_fields does not receive the current environment). Another consequence is that various functions may be called with the expansion of this type abbreviation, which is a Tfield, e.g. during printing.
Concrete problems have been fixed, but new bugs may appear in the future. (Test cases were added to typing-gadts/test.ml)
val associate_fields :
(string * Types.field_kind * Types.type_expr) list ->
(string * Types.field_kind * Types.type_expr) list ->
(string
* Types.field_kind
* Types.type_expr
* Types.field_kind
* Types.type_expr)
list
* (string * Types.field_kind * Types.type_expr) list
* (string * Types.field_kind * Types.type_expr) listval opened_object : Types.type_expr -> boolval set_object_name :
Ident.t ->
Types.type_expr list ->
Types.type_expr ->
unitval remove_object_name : Types.type_expr -> unitval find_cltype_for_path :
Env.t ->
Path.t ->
Types.type_declaration * Types.type_exprval sort_row_fields :
(Ocaml_parsing.Asttypes.label * Types.row_field) list ->
(Ocaml_parsing.Asttypes.label * Types.row_field) listval merge_row_fields :
(Ocaml_parsing.Asttypes.label * Types.row_field) list ->
(Ocaml_parsing.Asttypes.label * Types.row_field) list ->
(Ocaml_parsing.Asttypes.label * Types.row_field) list
* (Ocaml_parsing.Asttypes.label * Types.row_field) list
* (Ocaml_parsing.Asttypes.label * Types.row_field * Types.row_field) listval filter_row_fields :
bool ->
(Ocaml_parsing.Asttypes.label * Types.row_field) list ->
(Ocaml_parsing.Asttypes.label * Types.row_field) listval generalize : Types.type_expr -> unitval lower_contravariant : Env.t -> Types.type_expr -> unitval lower_variables_only : Env.t -> int -> Types.type_expr -> unitval enforce_current_level : Env.t -> Types.type_expr -> unitval generalize_structure : Types.type_expr -> unitval generalize_class_type : Types.class_type -> unitval generalize_class_type_structure : Types.class_type -> unitval generalize_class_signature_spine : Env.t -> Types.class_signature -> unitval correct_levels : Types.type_expr -> Types.type_exprval limited_generalize : Types.type_expr -> Types.type_expr -> unitval limited_generalize_class_type : Types.type_expr -> Types.class_type -> unitval fully_generic : Types.type_expr -> boolval check_scope_escape : Env.t -> int -> Types.type_expr -> unitval instance : ?partial:bool -> Types.type_expr -> Types.type_exprval generic_instance : Types.type_expr -> Types.type_exprval instance_list : Types.type_expr list -> Types.type_expr listval new_local_type :
?loc:Ocaml_parsing.Location.t ->
?manifest_and_scope:(Types.type_expr * int) ->
Types.type_origin ->
(Mode.allowed * 'r) Types.jkind ->
Types.type_declarationmodule Pattern_env : sig ... endtype existential_treatment = | Keep_existentials_flexible| Make_existentials_abstract of Pattern_env.tval instance_constructor :
existential_treatment ->
Types.constructor_description ->
Types.constructor_argument list * Types.type_expr * Types.type_expr listval instance_parameterized_type :
?keep_names:bool ->
Types.type_expr list ->
Types.type_expr ->
Types.type_expr list * Types.type_exprval instance_declaration : Types.type_declaration -> Types.type_declarationval generic_instance_declaration :
Types.type_declaration ->
Types.type_declarationval instance_class :
Types.type_expr list ->
Types.class_type ->
Types.type_expr list * Types.class_typeval instance_poly :
?keep_names:bool ->
Types.type_expr list ->
Types.type_expr ->
Types.type_exprval instance_poly_fixed :
?keep_names:bool ->
Types.type_expr list ->
Types.type_expr ->
Types.type_expr list * Types.type_exprval polyfy :
Env.t ->
Types.type_expr ->
Types.type_expr list ->
Types.type_expr * boolval instance_label :
fixed:bool ->
_ Types.gen_label_description ->
Types.type_expr list * Types.type_expr * Types.type_exprval prim_mode :
(Mode.allowed * 'r) Mode.Locality.t option ->
(Primitive.mode * Primitive.native_repr) ->
(Mode.allowed * 'r) Mode.Locality.tval instance_prim :
Primitive.description ->
Types.type_expr ->
Types.type_expr
* Mode.Locality.lr option
* (Mode.Forkable.lr * Mode.Yielding.lr) option
* Jkind.Sort.t optionval curry_mode : Mode.Alloc.Const.t -> Mode.Alloc.Const.t -> Mode.Alloc.Const.tGiven (a @ m1 -> b -> c) @ m0, where m0 and m1 are modes expressed by user-syntax, curry_mode m0 m1 gives the mode we implicitly interpret b->c to have.
val apply :
?use_current_level:bool ->
Env.t ->
Types.type_expr list ->
Types.type_expr ->
Types.type_expr list ->
Types.type_exprval try_expand_once_opt : Env.t -> Types.type_expr -> Types.type_exprval try_expand_safe_opt : Env.t -> Types.type_expr -> Types.type_exprval expand_head_once : Env.t -> Types.type_expr -> Types.type_exprval expand_head : Env.t -> Types.type_expr -> Types.type_exprval expand_head_opt : Env.t -> Types.type_expr -> Types.type_exprThe compiler's own version of expand_head necessary for type-based optimisations.
Expansion of types for error traces; lives here instead of in Errortrace because the expansion machinery lives here.
val expanded_diff :
Env.t ->
got:Types.type_expr ->
expected:Types.type_expr ->
(Errortrace.expanded_type, 'variant) Errortrace.eltCreate an Errortrace.Diff by expanding the two types
val unexpanded_diff :
got:Types.type_expr ->
expected:Types.type_expr ->
(Errortrace.expanded_type, 'variant) Errortrace.eltCreate an Errortrace.Diff by *duplicating* the two types, so that each one's expansion is identical to itself. Despite the name, does create Errortrace.expanded_types.
val full_expand :
may_forget_scope:bool ->
Env.t ->
Types.type_expr ->
Types.type_exprtype typedecl_extraction_result = | Typedecl of Path.t * Path.t * Types.type_declaration| Has_no_typedecl| May_have_typedeclval extract_concrete_typedecl :
Env.t ->
Types.type_expr ->
typedecl_extraction_resultval unify : Env.t -> Types.type_expr -> Types.type_expr -> unitval unify_gadt :
Pattern_env.t ->
Types.type_expr ->
Types.type_expr ->
Btype.TypePairs.tval unify_var : Env.t -> Types.type_expr -> Types.type_expr -> unitval unify_delaying_jkind_checks :
Env.t ->
Types.type_expr ->
Types.type_expr ->
(Types.type_expr * Types.jkind_r) listtype filtered_arrow = {ty_arg : Types.type_expr;arg_mode : Mode.Alloc.lr;ty_ret : Types.type_expr;ret_mode : Mode.Alloc.lr;}val filter_arrow :
Env.t ->
Types.type_expr ->
Types.arg_label ->
force_tpoly:bool ->
filtered_arrowval filter_mono : Types.type_expr -> Types.type_exprval filter_arrow_mono :
Env.t ->
Types.type_expr ->
Types.arg_label ->
filtered_arrowval filter_method : Env.t -> string -> Types.type_expr -> Types.type_exprval occur_in : Env.t -> Types.type_expr -> Types.type_expr -> boolval deep_occur_list : Types.type_expr -> Types.type_expr list -> boolval deep_occur : Types.type_expr -> Types.type_expr -> boolval moregeneral : Env.t -> bool -> Types.type_expr -> Types.type_expr -> unitval is_moregeneral :
Env.t ->
bool ->
Types.type_expr ->
Types.type_expr ->
boolval all_distinct_vars : Env.t -> Types.type_expr list -> booltype matches_result = | Unification_failure of Errortrace.unification_error| Jkind_mismatch of {original_jkind : Types.jkind_lr;inferred_jkind : Types.jkind_lr;ty : Types.type_expr;}| All_goodval matches :
expand_error_trace:bool ->
Env.t ->
Types.type_expr ->
Types.type_expr ->
matches_resultval reify_univars : Env.t -> Types.type_expr -> Types.type_exprtype filter_arrow_failure = | Unification_error of Errortrace.unification_error| Label_mismatch of {got : Types.arg_label;expected : Types.arg_label;expected_type : Types.type_expr;}| Not_a_function| Jkind_error of Types.type_expr * Jkind.Violation.texception Filter_arrow_failed of filter_arrow_failuretype filter_method_failure = | Unification_error of Errortrace.unification_error| Not_a_method| Not_an_object of Types.type_expr| Not_a_value of Jkind.Violation.texception Filter_method_failed of filter_method_failuretype class_match_failure = | CM_Virtual_class| CM_Parameter_arity_mismatch of int * int| CM_Type_parameter_mismatch of int * Env.t * Errortrace.equality_error| CM_Class_type_mismatch of Env.t * Types.class_type * Types.class_type| CM_Parameter_mismatch of int * Env.t * Errortrace.moregen_error| CM_Val_type_mismatch of string * Env.t * Errortrace.comparison_error| CM_Meth_type_mismatch of string * Env.t * Errortrace.comparison_error| CM_Non_mutable_value of string| CM_Non_concrete_value of string| CM_Missing_value of string| CM_Missing_method of string| CM_Hide_public of string| CM_Hide_virtual of string * string| CM_Public_method of string| CM_Private_method of string| CM_Virtual_method of stringval match_class_types :
?trace:bool ->
Env.t ->
Types.class_type ->
Types.class_type ->
class_match_failure listval equal :
?do_jkind_check:bool ->
Env.t ->
bool ->
Types.type_expr list ->
Types.type_expr list ->
unitval is_equal :
Env.t ->
bool ->
Types.type_expr list ->
Types.type_expr list ->
boolval equal_private : Env.t -> Types.type_expr -> Types.type_expr -> unitval match_class_declarations :
Env.t ->
Types.type_expr list ->
Types.class_type ->
Types.type_expr list ->
Types.class_type ->
class_match_failure listval enlarge_type : Env.t -> Types.type_expr -> Types.type_expr * boolval subtype : Env.t -> Types.type_expr -> Types.type_expr -> unit -> unitmodule Rigidify : sig ... endval new_class_signature : unit -> Types.class_signatureval add_dummy_method : Env.t -> scope:int -> Types.class_signature -> unitexception Add_method_failed of add_method_failureval add_method :
Env.t ->
Ocaml_parsing.Asttypes.label ->
Ocaml_parsing.Asttypes.private_flag ->
Ocaml_parsing.Asttypes.virtual_flag ->
Types.type_expr ->
Types.class_signature ->
unittype add_instance_variable_failure = | Mutability_mismatch of Ocaml_parsing.Asttypes.mutable_flag| Type_mismatch of Errortrace.unification_errorexception Add_instance_variable_failed of add_instance_variable_failureval add_instance_variable :
strict:bool ->
Env.t ->
Ocaml_parsing.Asttypes.label ->
Ocaml_parsing.Asttypes.mutable_flag ->
Ocaml_parsing.Asttypes.virtual_flag ->
Types.type_expr ->
Types.class_signature ->
unittype inherit_class_signature_failure = | Self_type_mismatch of Errortrace.unification_error| Method of Ocaml_parsing.Asttypes.label * add_method_failure| Instance_variable of Ocaml_parsing.Asttypes.label
* add_instance_variable_failureexception Inherit_class_signature_failed of inherit_class_signature_failureval inherit_class_signature :
strict:bool ->
Env.t ->
Types.class_signature ->
Types.class_signature ->
unitval update_class_signature :
Env.t ->
Types.class_signature ->
Ocaml_parsing.Asttypes.label list * Ocaml_parsing.Asttypes.label listval hide_private_methods : Env.t -> Types.class_signature -> unitval close_class_signature : Env.t -> Types.class_signature -> boolexception Nondep_cannot_erase of Ident.tval nondep_type : Env.t -> Ident.t list -> Types.type_expr -> Types.type_exprval nondep_type_decl :
Env.t ->
Ident.t list ->
bool ->
Types.type_declaration ->
Types.type_declarationval nondep_extension_constructor :
Env.t ->
Ident.t list ->
Types.extension_constructor ->
Types.extension_constructorval nondep_class_declaration :
Env.t ->
Ident.t list ->
Types.class_declaration ->
Types.class_declarationval nondep_cltype_declaration :
Env.t ->
Ident.t list ->
Types.class_type_declaration ->
Types.class_type_declarationval normalize_type : Types.type_expr -> unitval remove_mode_and_jkind_variables : Types.type_expr -> unitval nongen_vars_in_schema : Env.t -> Types.type_expr -> Btype.TypeSet.t optionval nongen_vars_in_class_declaration :
Types.class_declaration ->
Btype.TypeSet.t optiontype closed_class_failure = {free_variable : Types.type_expr * variable_kind;meth : string;meth_ty : Types.type_expr;}val free_variables : ?env:Env.t -> Types.type_expr -> Types.type_expr listval free_non_row_variables_of_list :
Types.type_expr list ->
Types.type_expr listval free_variable_set_of_list :
Env.t ->
Types.type_expr list ->
Btype.TypeSet.tval exists_free_variable :
(Types.type_expr -> Types.jkind_lr -> bool) ->
Types.type_expr ->
boolval closed_type_expr : ?env:Env.t -> Types.type_expr -> boolval closed_type_decl : Types.type_declaration -> Types.type_expr optionval closed_extension_constructor :
Types.extension_constructor ->
Types.type_expr optionval closed_class :
Types.type_expr list ->
Types.class_signature ->
closed_class_failure optionval unalias : Types.type_expr -> Types.type_exprval arity : Types.type_expr -> intval collapse_conj_params : Env.t -> Types.type_expr list -> unitval wrap_trace_gadt_instances : Env.t -> ('a -> 'b) -> 'a -> 'bval package_subtype :
(Env.t ->
Path.t ->
(Ocaml_parsing.Longident.t * Types.type_expr) list ->
Path.t ->
(Ocaml_parsing.Longident.t * Types.type_expr) list ->
bool)
refval mcomp : Env.t -> Types.type_expr -> Types.type_expr -> unitval get_unboxed_type_representation :
Env.t ->
Types.type_expr ->
(unwrapped_type_expr, unwrapped_type_expr) resultval get_unboxed_type_approximation :
Env.t ->
Types.type_expr ->
unwrapped_type_exprval contained_without_boxing : Env.t -> Types.type_expr -> Types.type_expr listval estimate_type_jkind : Env.t -> Types.type_expr -> Types.jkind_lval type_jkind : Env.t -> Types.type_expr -> Types.jkind_lval type_jkind_purely : Env.t -> Types.type_expr -> Types.jkind_lval type_jkind_purely_if_principal :
Env.t ->
Types.type_expr ->
Types.jkind_l optionval mk_jkind_context :
Env.t ->
(Types.type_expr -> Types.jkind_l option) ->
Jkind.jkind_contextval mk_jkind_context_check_principal : Env.t -> Jkind.jkind_contextval mk_jkind_context_always_principal : Env.t -> Jkind.jkind_contextval type_sort :
why:Jkind.History.concrete_creation_reason ->
fixed:bool ->
Env.t ->
Types.type_expr ->
(Jkind.sort, Jkind.Violation.t) resultval check_decl_jkind :
Env.t ->
Types.type_declaration ->
Types.jkind_l ->
(unit, Jkind.Violation.t) resultval constrain_decl_jkind :
Env.t ->
Types.type_declaration ->
Types.jkind_l ->
(unit, Jkind.Violation.t) resultval type_equal : Env.t -> Types.type_expr -> Types.type_expr -> boolval check_type_jkind :
Env.t ->
Types.type_expr ->
('l * Mode.allowed) Types.jkind ->
(unit, Jkind.Violation.t) resultval constrain_type_jkind :
Env.t ->
Types.type_expr ->
('l * Mode.allowed) Types.jkind ->
(unit, Jkind.Violation.t) resultval check_type_externality :
Env.t ->
Types.type_expr ->
Jkind_axis.Externality.t ->
boolval is_always_gc_ignorable : Env.t -> Types.type_expr -> boolval check_type_nullability :
Env.t ->
Types.type_expr ->
Jkind_axis.Nullability.t ->
boolval check_type_separability :
Env.t ->
Types.type_expr ->
Jkind_axis.Separability.t ->
boolval check_and_update_generalized_ty_jkind :
?name:Ident.t ->
loc:Ocaml_parsing.Location.t ->
Env.t ->
Types.type_expr ->
unitval is_principal : Types.type_expr -> boolval global_state : global_stateval print_global_state : Format.formatter -> global_state -> unitval crossing_of_jkind : Env.t -> 'd Types.jkind -> Mode.Crossing.tGet the crossing of a jkind
val crossing_of_ty :
Env.t ->
?modalities:Mode.Modality.Const.t ->
Types.type_expr ->
Mode.Crossing.tGet the crossing of a type wrapped in modalities. Non-principal types get trivial crossing.
val cross_right :
Env.t ->
?modalities:Mode.Modality.Const.t ->
Types.type_expr ->
Mode.Value.r ->
Mode.Value.rCross a right mode according to a type wrapped in modalities. Non-principal types don't cross.
val cross_left :
Env.t ->
?modalities:Mode.Modality.Const.t ->
Types.type_expr ->
Mode.Value.l ->
Mode.Value.lCross a left mode according to a type wrapped in modalities. Non-principal types don't cross.
val cross_right_alloc :
Env.t ->
?modalities:Mode.Modality.Const.t ->
Types.type_expr ->
Mode.Alloc.r ->
Mode.Alloc.rSimilar to cross_right but for Mode.Alloc
val cross_left_alloc :
Env.t ->
?modalities:Mode.Modality.Const.t ->
Types.type_expr ->
Mode.Alloc.l ->
Mode.Alloc.lSimilar to cross_left but for Mode.Alloc
val zap_modalities_to_floor_if_modes_enabled_at :
Ocaml_parsing.Language_extension.maturity ->
Mode.Modality.t ->
Mode.Modality.Const.tZap a modality to floor if the modes extension is enabled at a level more immature than the given one. Zap to id otherwise.
val mode_crossing_structure_memaddr : Mode.Crossing.tThe mode crossing of the memory block of a structure.
val mode_crossing_functor : Mode.Crossing.tThe mode crossing of a functor.
val mode_crossing_module : Mode.Crossing.tThe mode crossing of any module.
val zap_modalities_to_floor_if_at_least :
Ocaml_parsing.Language_extension.maturity ->
Mode.Modality.t ->
Mode.Modality.Const.tZap a modality to floor if maturity allows, zap to id otherwise.
val check_constructor_crossing_creation :
Env.t ->
Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc ->
Types.tag ->
res:Types.type_expr ->
args:Types.constructor_argument list ->
Env.locks ->
(Mode.Value.r, Mode.Value.error) resultval check_constructor_crossing_destruction :
Env.t ->
Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc ->
Types.tag ->
res:Types.type_expr ->
args:Types.constructor_argument list ->
Env.locks ->
(Mode.Value.l, Mode.Value.error) result