Module Ocaml_typing.Types
Representation of types and declarations
Types defines the representation of types and declarations (that is, the content of module signatures).
CMI files are made of marshalled types.
Asttypes exposes basic definitions shared both by Parsetree and Types.
type mutability = | Immutable| Mutable of {mode : Ocaml_typing.Mode.Value.Comonadic.lr;(*Mode of new field value in mutation.
*)atomic : Ocaml_typing.Types.atomic;
}
Describes a mutable field/element.
val is_mutable : Ocaml_typing.Types.mutability -> boolReturns true is the mutable_flag is mutable or atomic. Should be called if not interested in the payload of Mutable.
val is_atomic : Ocaml_typing.Types.mutability -> boolReturns true is the mutable_flag is atomic. Should be called if not interested in the payload of Mutable.
val mutable_mode :
('l * 'r) Ocaml_typing.Mode.Value.Comonadic.t ->
('l * 'r) Ocaml_typing.Mode.Value.tGiven the parameter m0 on mutable, return the mode of future writes.
Type expressions for the core language.
The type_desc variant defines all the possible type expressions one can find in OCaml. type_expr wraps this with some annotations.
The level field tracks the level of polymorphism associated to a type, guiding the generalization algorithm. Put shortly, when referring to a type in a given environment, both the type and the environment have a level. If the type has an higher level, then it can be considered fully polymorphic (type variables will be printed as 'a), otherwise it'll be weakly polymorphic, or non generalized (type variables printed as '_a). See http://okmij.org/ftp/ML/generalization.html for more information.
Note about type_declaration: one should not make the confusion between type_expr and type_declaration.
type_declaration refers specifically to the type construct in OCaml language, where you create and name a new type or type alias.
type_expr is used when you refer to existing types, e.g. when annotating the expected type of a value.
Also, as the type system of OCaml is generative, a type_declaration can have the side-effect of introducing a new type constructor, different from all other known types. Whereas type_expr is a pure construct which allows referring to existing types.
Note on mutability: TBD.
module Jkind_mod_bounds : sig ... endThe mod-bounds of a jkind
module With_bounds_type_info : sig ... endInformation tracked about an individual type within the with-bounds for a jkind
and type_desc = | Tvar of {name : string option;jkind : Ocaml_typing.Types.jkind_lr;
}(*
*)Tvar (Some "a")==>'aor'_aTvar None==>_| Tarrow of Ocaml_typing.Types.arrow_desc * Ocaml_typing.Types.type_expr * Ocaml_typing.Types.type_expr * Ocaml_typing.Types.commutable(*Tarrow (Nolabel, e1, e2, c)==>e1 -> e2Tarrow (Labelled "l", e1, e2, c)==>l:e1 -> e2Tarrow (Optional "l", e1, e2, c)==>?l:e1 -> e2See
*)commutablefor the last argument. The argument type must be aTpolynode| Ttuple of (string option * Ocaml_typing.Types.type_expr) list(*Ttuple [None, t1; ...; None, tn]==>t1 * ... * tnTtuple [Some "l1", t1; ...; Some "ln", tn]==>l1:t1 * ... * ln:tnAny mix of labeled and unlabeled components also works:
*)Ttuple [Some "l1", t1; None, t2; Some "l3", t3]==>l1:t1 * t2 * l3:t3| Tunboxed_tuple of (string option * Ocaml_typing.Types.type_expr) list(*Tunboxed_tuple [None, t1; ...; None, tn]==>#(t1 * ... * tn)Tunboxed_tuple [Some "l1", t1; ...; Some "ln", tn]==>#(l1:t1 * ... * ln:tn)Any mix of labeled and unlabeled components also works:
*)Tunboxed_tuple [Some "l1", t1; None, t2; Some "l3", t3]==>#(l1:t1 * t2 * l3:t3)| Tconstr of Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list * Ocaml_typing.Types.abbrev_memo Stdlib.ref(*
*)Tconstr (`A.B.t', [t1;...;tn], _)==>(t1,...,tn) A.B.tThe last parameter keep tracks of known expansions, seeabbrev_memo.| Tobject of Ocaml_typing.Types.type_expr * (Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) option Stdlib.ref(*Tobject (`f1:t1;...;fn: tn', `None')==>< f1: t1; ...; fn: tn >f1, fn are represented as a linked list of types using Tfield and Tnil constructors.Tobject (_, `Some (`A.ct', [t1;...;tn]')==>(t1, ..., tn) A.ct. where A.ct is the type of some class.There are also special cases for so-called "class-types", cf.
TypeclassandCtype.set_object_name:Tobject (Tfield(_,_,...(Tfield(_,_,rv)...), Some(`A.#ct`, [rv;t1;...;tn])==>(t1, ..., tn) #A.ctTobject (_, Some(`A.#ct`, [Tnil;t1;...;tn])==>(t1, ..., tn) A.ctwhere
*)rvis the hidden row variable.| Tfield of string * Ocaml_typing.Types.field_kind * Ocaml_typing.Types.type_expr * Ocaml_typing.Types.type_expr(*
*)Tfield ("foo", field_public, t, ts)==><...; foo : t; ts>| Tquote of Ocaml_typing.Types.type_expr(*
*)Tquote t==><[ t ]>| Tsplice of Ocaml_typing.Types.type_expr(*
*)Tsplice t==>$t| Tnil(*
*)Tnil==><...; >| Tlink of Ocaml_typing.Types.type_expr(*Indirection used by unification engine.
*)| Tsubst of Ocaml_typing.Types.type_expr * Ocaml_typing.Types.type_expr option(*
*)Tsubstis used temporarily to store information in low-level functions manipulating representation of types, such as instantiation or copy. The first argument contains a copy of the original node. The second is available only when the first is the row variable of a polymorphic variant. It then contains a copy of the whole variant. This constructor should not appear outside of these cases.| Tvariant of Ocaml_typing.Types.row_desc(*Representation of polymorphic variants, see
*)row_desc.| Tunivar of {name : string option;jkind : Ocaml_typing.Types.jkind_lr;
}(*Occurrence of a type variable introduced by a forall quantifier /
*)Tpoly.| Tpoly of Ocaml_typing.Types.type_expr * Ocaml_typing.Types.type_expr list(*
*)Tpoly (ty,tyl)==>'a1... 'an. ty, where 'a1 ... 'an are names given to types in tyl and occurrences of those types in ty.| Tpackage of Ocaml_typing.Path.t * (Ocaml_parsing.Longident.t * Ocaml_typing.Types.type_expr) list(*Type of a first-class module (a.k.a package).
*)| Tof_kind of Ocaml_typing.Types.jkind_lr(*Tof_kind jkind==>(type : jkind)The "canonical" type of a particular kind.
These types are uninhabited, and any appearing in translation will cause an error. They are only used to represent the kinds of existentially-quantified types mentioned in with-bounds. See test typing-jkind-bounds/gadt.ml
*)
This is used in the Typedtree. It is distinct from arg_label because Position argument labels are discovered through typechecking.
and arrow_desc =
Ocaml_typing.Types.arg_label
* Ocaml_typing.Mode.Alloc.lr
* Ocaml_typing.Mode.Alloc.lrand fixed_explanation = | Univar of Ocaml_typing.Types.type_expr(*The row type was bound to an univar
*)| Fixed_private(*The row type is private
*)| Reified of Ocaml_typing.Path.t(*The row was reified
*)| Rigid(*The row type was made rigid during constraint verification
*)| Fixed_existential(*The row type is existential in a with-bound. See Note
*)With-bounds for GADTsin Jkind.
See also documentation for row_more, which enumerates how these constructors arise.
and abbrev_memo = | Mnil(*No known abbreviation
*)| Mcons of Ocaml_parsing.Asttypes.private_flag * Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr * Ocaml_typing.Types.type_expr * Ocaml_typing.Types.abbrev_memo(*Found one abbreviation. A valid abbreviation should be at least as visible and reachable by the same path. The first expression is the abbreviation and the second the expansion.
*)| Mlink of Ocaml_typing.Types.abbrev_memo Stdlib.ref(*Abbreviations can be found after this indirection
*)
abbrev_memo allows one to keep track of different expansions of a type alias. This is done for performance purposes.
For instance, when defining type 'a pair = 'a * 'a, when one refers to an 'a pair, it is just a shortcut for the 'a * 'a type. This expansion will be stored in the abbrev_memo of the corresponding Tconstr node.
In practice, abbrev_memo behaves like list of expansions with a mutable tail.
Note on marshalling: abbrev_memo must not appear in saved types. Btype, with cleanup_abbrev and memo, takes care of tracking and removing abbreviations.
commutable is a flag appended to every arrow type.
When typing an application, if the type of the functional is known, its type is instantiated with commu_ok arrows, otherwise as commu_var ().
When the type is not known, the application will be used to infer the actual type. This is fragile in presence of labels where there is no principal type.
Two incompatible applications must rely on is_commu_ok arrows, otherwise they will trigger an error.
let f g = g ~a:() ~b:(); g ~b:() ~a:();
Error: This function is applied to arguments in an order different from other calls. This is only allowed when the real type is known.
and jkind_history = | Interact of {reason : Ocaml_typing.Jkind_intf.History.interact_reason;jkind1 : Ocaml_typing.Types.jkind_desc_packed;history1 : Ocaml_typing.Types.jkind_history;jkind2 : Ocaml_typing.Types.jkind_desc_packed;history2 : Ocaml_typing.Types.jkind_history;
}| Creation of Ocaml_typing.Jkind_intf.History.creation_reason
A history of conditions placed on a jkind.
INVARIANT: at most one sort variable appears in this history. This is a natural consequence of producing this history by comparing jkinds.
and 'd with_bounds = | No_with_bounds : ('l * 'r) Ocaml_typing.Types.with_bounds| With_bounds : Ocaml_typing.Types.with_bounds_types -> ('l * Ocaml_typing.Allowance.disallowed) Ocaml_typing.Types.with_bounds(*Invariant : there must always be at least one type in this set *
*)
and ('layout, 'd) layout_and_axes = {layout : 'layout;mod_bounds : Ocaml_typing.Types.Jkind_mod_bounds.t;with_bounds : 'd Ocaml_typing.Types.with_bounds;
} constraint 'd = 'l * 'rand 'd jkind_desc =
(Ocaml_typing.Jkind_types.Sort.t Ocaml_typing.Jkind_types.Layout.t, 'd)
Ocaml_typing.Types.layout_and_axes constraint 'd = 'l * 'rand jkind_desc_packed = | Pack_jkind_desc : ('l * 'r) Ocaml_typing.Types.jkind_desc -> Ocaml_typing.Types.jkind_desc_packed
and 'd jkind_quality = | Best : ('l * Ocaml_typing.Allowance.disallowed) Ocaml_typing.Types.jkind_quality| Not_best : ('l * 'r) Ocaml_typing.Types.jkind_quality
The "quality" of a jkind indicates whether we are able to learn more about the jkind later.
We can never learn more about a Best jkind to make it "lower" (according to Jkind.sub / Jkind.sub_jkind_l). A Not_best, jkind, however, might have more information provided about it later that makes it lower.
Note that only left jkinds can be Best (meaning we can never compare less than or equal to a left jkind!)
and 'd jkind = {jkind : 'd Ocaml_typing.Types.jkind_desc;annotation : Ocaml_parsing.Parsetree.jkind_annotation option;history : Ocaml_typing.Types.jkind_history;has_warned : bool;ran_out_of_fuel_during_normalize : bool;quality : 'd Ocaml_typing.Types.jkind_quality;
} constraint 'd = 'l * 'rand jkind_lr =
(Ocaml_typing.Allowance.allowed * Ocaml_typing.Allowance.allowed)
Ocaml_typing.Types.jkindand jkind_packed = | Pack_jkind : ('l * 'r) Ocaml_typing.Types.jkind -> Ocaml_typing.Types.jkind_packed
module With_bounds_types : sig ... endval is_commu_ok : Ocaml_typing.Types.commutable -> boolval commu_ok : Ocaml_typing.Types.commutableval commu_var : unit -> Ocaml_typing.Types.commutablefield_kind indicates the accessibility of a method.
An Fprivate field may become Fpublic or Fabsent during unification, but not the other way round.
The same field_kind is kept shared when copying Tfield nodes so that the copies of the self-type of a class share the same accessibility (see also PR#10539).
val field_kind_repr :
Ocaml_typing.Types.field_kind ->
Ocaml_typing.Types.field_kind_viewval field_public : Ocaml_typing.Types.field_kindval field_absent : Ocaml_typing.Types.field_kindval field_private : unit -> Ocaml_typing.Types.field_kindval field_kind_internal_repr :
Ocaml_typing.Types.field_kind ->
Ocaml_typing.Types.field_kindGetters for type_expr; calls repr before answering a value
val get_desc : Ocaml_typing.Types.type_expr -> Ocaml_typing.Types.type_descval get_level : Ocaml_typing.Types.type_expr -> intval get_scope : Ocaml_typing.Types.type_expr -> intval get_id : Ocaml_typing.Types.type_expr -> intval with_type_mark : (Ocaml_typing.Types.type_mark -> 'a) -> 'aval not_marked_node :
Ocaml_typing.Types.type_mark ->
Ocaml_typing.Types.type_expr ->
boolval try_mark_node :
Ocaml_typing.Types.type_mark ->
Ocaml_typing.Types.type_expr ->
booltype transient_expr = private {mutable desc : Ocaml_typing.Types.type_desc;mutable level : int;mutable scope : Ocaml_typing.Types.scope_field;id : int;
}Transient type_expr. Should only be used immediately after Transient_expr.repr
module Transient_expr : sig ... endOperations on transient_expr
val create_expr :
Ocaml_typing.Types.type_desc ->
level:int ->
scope:int ->
id:int ->
Ocaml_typing.Types.type_exprFunctions and definitions moved from Btype
val newty3 :
level:int ->
scope:int ->
Ocaml_typing.Types.type_desc ->
Ocaml_typing.Types.type_exprCreate a type with a fresh id
val newty2 :
level:int ->
Ocaml_typing.Types.type_desc ->
Ocaml_typing.Types.type_exprCreate a type with a fresh id and no scope
module TransientTypeOps : sig ... endComparisons for functors
module TransientTypeHash :
Stdlib.Hashtbl.S with type key = Ocaml_typing.Types.transient_exprComparisons for type_expr; cannot be used for functors
val eq_type :
Ocaml_typing.Types.type_expr ->
Ocaml_typing.Types.type_expr ->
boolval compare_type :
Ocaml_typing.Types.type_expr ->
Ocaml_typing.Types.type_expr ->
intConstructor and accessors for row_desc
`X | `Y (row_closed = true) < `X | `Y (row_closed = true) > `X | `Y (row_closed = false) < `X | `Y > `X (row_closed = true)
type t = > `X as 'a (row_more = Tvar a) type t = private > `X (row_more = Tconstr ("t#row", , ref Mnil))
And for:
let f = function `X -> `X -> | `Y -> `X
the type of "f" will be a Tarrow whose lhs will (basically) be:
Tvariant row_fields = [("X", _)];
row_more =
Tvariant { row_fields = [("Y", _)];
row_more =
Tvariant { row_fields = [];
row_more = _;
_ ; _
}
; _
}
val create_row :
fields:(Ocaml_parsing.Asttypes.label * Ocaml_typing.Types.row_field) list ->
more:Ocaml_typing.Types.type_expr ->
closed:bool ->
fixed:Ocaml_typing.Types.fixed_explanation option ->
name:(Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) option ->
Ocaml_typing.Types.row_descval row_fields :
Ocaml_typing.Types.row_desc ->
(Ocaml_parsing.Asttypes.label * Ocaml_typing.Types.row_field) listval row_more : Ocaml_typing.Types.row_desc -> Ocaml_typing.Types.type_exprrow_more returns a type_expr with one of the following type_descs (also described with the return from row_fixed, which varies similarly):
* Tvar: This is a row variable; it would occur in e.g. val f : [> `A | `B] -> int. When/if we learn more about a polymorphic variant, this variable might get unified with one of the other type_descs listed here, or a Tvariant that represents a new set of constructors to add to the row.
During constraint checking (toward the end of checking a type declaration, in Typedecl.check_constraints_rec) we Ctype.rigidify a type to make it so that its unification variables will not unify. When a Tvar row variable is rigidified, its fixed_explanation will be Rigid.
* Tunivar: This is a universally quantified row variable; it would occur in e.g. type t = { f : 'a. ([> `A | `B ] as 'a) -> int }. A Tunivar has a fixed_explanation of Univar.
* Tconstr: There are two possible ways this can happen:
1. This is an abstract #row type created by a private row type, as in type t = private [> `A | `B]. In this case, the fixed_explanation will be Fixed_private.
2. This is a locally abstract type created by Ctype.reify, which happens when a row variable is free in the type of the scrutinee in a GADT pattern match. The fixed_explanation will be Reified. Note that any manifest of a reified row variable is actually ignored by row_repr; this causes some incompletness in type inference.
* Tnil: Used to denote a static polymorphic variant (with no > or <).
* Tof_kind: See Wrinkle BW2 in Note With-bounds for GADTs in Jkind. Briefly, Tof_kind can appear as a row_more when computing the kind of a GADT with an existentially-bound row variable. The fixed_explanation will be Fixed_existential.
----------------------------------------
It is an invariant that row variables are never shared between different types. That is, if row_more row1 == row_more row2, then row1 and row2 come from structurally identical Tvariants (but they might not be physically equal). When copying types, two types with the same row_more field are replaced by the same copy.
val row_closed : Ocaml_typing.Types.row_desc -> boolval row_fixed :
Ocaml_typing.Types.row_desc ->
Ocaml_typing.Types.fixed_explanation optionSee documentation for row_more.
val row_name :
Ocaml_typing.Types.row_desc ->
(Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) optionval set_row_name :
Ocaml_typing.Types.row_desc ->
(Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) option ->
Ocaml_typing.Types.row_descval get_row_field :
Ocaml_parsing.Asttypes.label ->
Ocaml_typing.Types.row_desc ->
Ocaml_typing.Types.row_fieldtype row_desc_repr = | Row of {fields : (Ocaml_parsing.Asttypes.label * Ocaml_typing.Types.row_field) list;more : Ocaml_typing.Types.type_expr;closed : bool;fixed : Ocaml_typing.Types.fixed_explanation option;name : (Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) option;
}
get all fields at once; different from the old row_repr
val row_repr : Ocaml_typing.Types.row_desc -> Ocaml_typing.Types.row_desc_reprtype row_field_view = | Rpresent of Ocaml_typing.Types.type_expr option| Reither of bool * Ocaml_typing.Types.type_expr list * bool| Rabsent
Current contents of a row field
val row_field_repr :
Ocaml_typing.Types.row_field ->
Ocaml_typing.Types.row_field_viewval rf_present :
Ocaml_typing.Types.type_expr option ->
Ocaml_typing.Types.row_fieldval rf_absent : Ocaml_typing.Types.row_fieldval rf_either :
?use_ext_of:Ocaml_typing.Types.row_field ->
no_arg:bool ->
Ocaml_typing.Types.type_expr list ->
matched:bool ->
Ocaml_typing.Types.row_fieldval rf_either_of :
Ocaml_typing.Types.type_expr option ->
Ocaml_typing.Types.row_fieldval eq_row_field_ext :
Ocaml_typing.Types.row_field ->
Ocaml_typing.Types.row_field ->
boolval changed_row_field_exts :
Ocaml_typing.Types.row_field list ->
(unit -> unit) ->
boolval match_row_field :
present:(Ocaml_typing.Types.type_expr option -> 'a) ->
absent:(unit -> 'a) ->
either:
(bool ->
Ocaml_typing.Types.type_expr list ->
bool ->
Ocaml_typing.Types.row_field option ->
'a) ->
Ocaml_typing.Types.row_field ->
'amodule Uid = Ocaml_typing.Shape.Uidmodule MethSet : Stdlib.Set.S with type elt = stringmodule VarSet : Stdlib.Set.S with type elt = stringmodule Meths : Stdlib.Map.S with type key = stringmodule Vars : Stdlib.Map.S with type key = stringtype value_kind = | Val_reg of Ocaml_typing.Jkind_types.Sort.t| Val_mut of Ocaml_typing.Mode.Value.Comonadic.lr * Ocaml_typing.Jkind_types.Sort.t| Val_prim of Ocaml_typing.Primitive.description| Val_ivar of Ocaml_parsing.Asttypes.mutable_flag * string| Val_self of Ocaml_typing.Types.class_signature * Ocaml_typing.Types.self_meths * Ocaml_typing.Ident.t Ocaml_typing.Types.Vars.t * string| Val_anc of Ocaml_typing.Types.class_signature * Ocaml_typing.Ident.t Ocaml_typing.Types.Meths.t * string
and self_meths = | Self_concrete of Ocaml_typing.Ident.t Ocaml_typing.Types.Meths.t| Self_virtual of Ocaml_typing.Ident.t Ocaml_typing.Types.Meths.t Stdlib.ref
and class_signature = {csig_self : Ocaml_typing.Types.type_expr;mutable csig_self_row : Ocaml_typing.Types.type_expr;mutable csig_vars : (Ocaml_parsing.Asttypes.mutable_flag * Ocaml_parsing.Asttypes.virtual_flag * Ocaml_typing.Types.type_expr) Ocaml_typing.Types.Vars.t;mutable csig_meths : (Ocaml_typing.Types.method_privacy * Ocaml_parsing.Asttypes.virtual_flag * Ocaml_typing.Types.type_expr) Ocaml_typing.Types.Meths.t;
}module Variance : sig ... endmodule Separability : sig ... endsee Typedecl_separability for an explanation of separability and separability modes.
type type_declaration = {type_params : Ocaml_typing.Types.type_expr list;type_arity : int;type_kind : Ocaml_typing.Types.type_decl_kind;type_jkind : Ocaml_typing.Types.jkind_l;type_private : Ocaml_parsing.Asttypes.private_flag;type_manifest : Ocaml_typing.Types.type_expr option;type_variance : Ocaml_typing.Types.Variance.t list;type_separability : Ocaml_typing.Types.Separability.t list;type_is_newtype : bool;type_expansion_scope : int;type_loc : Ocaml_parsing.Location.t;type_attributes : Ocaml_parsing.Parsetree.attributes;type_unboxed_default : bool;type_uid : Uid.t;type_unboxed_version : Ocaml_typing.Types.type_declaration option;
}and unsafe_mode_crossing = {unsafe_mod_bounds : Ocaml_typing.Mode.Crossing.t;unsafe_with_bounds : (Ocaml_typing.Allowance.allowed * Ocaml_typing.Allowance.disallowed) Ocaml_typing.Types.with_bounds;
}and ('lbl, 'lbl_flat, 'cstr) type_kind = | Type_abstract of Ocaml_typing.Types.type_origin| Type_record of 'lbl list * Ocaml_typing.Types.record_representation * Ocaml_typing.Types.unsafe_mode_crossing option| Type_record_unboxed_product of 'lbl_flat list * Ocaml_typing.Types.record_unboxed_product_representation * Ocaml_typing.Types.unsafe_mode_crossing option| Type_variant of 'cstr list * Ocaml_typing.Types.variant_representation * Ocaml_typing.Types.unsafe_mode_crossing option| Type_open
and mixed_block_element = | Value| Float_boxed| Float64| Float32| Bits8| Bits16| Untagged_immediate| Bits32| Bits64| Vec128| Vec256| Vec512| Word| Product of Ocaml_typing.Types.mixed_product_shape| Void
and mixed_product_shape = Ocaml_typing.Types.mixed_block_element arrayand module_representation = Ocaml_typing.Jkind_types.Sort.t arrayand record_representation = | Record_unboxed| Record_inlined of Ocaml_typing.Types.tag * Ocaml_typing.Types.constructor_representation * Ocaml_typing.Types.variant_representation| Record_boxed of Ocaml_typing.Jkind_types.Sort.Const.t array| Record_float| Record_ufloat| Record_mixed of Ocaml_typing.Types.mixed_product_shape
and variant_representation = | Variant_unboxed| Variant_boxed of (Ocaml_typing.Types.constructor_representation * Ocaml_typing.Jkind_types.Sort.Const.t array) array| Variant_extensible| Variant_with_null
and constructor_representation = | Constructor_uniform_value| Constructor_mixed of Ocaml_typing.Types.mixed_product_shape
and label_declaration = {ld_id : Ocaml_typing.Ident.t;ld_mutable : Ocaml_typing.Types.mutability;ld_modalities : Ocaml_typing.Mode.Modality.Const.t;ld_type : Ocaml_typing.Types.type_expr;ld_sort : Ocaml_typing.Jkind_types.Sort.Const.t;ld_loc : Ocaml_parsing.Location.t;ld_attributes : Ocaml_parsing.Parsetree.attributes;ld_uid : Uid.t;
}and constructor_declaration = {cd_id : Ocaml_typing.Ident.t;cd_args : Ocaml_typing.Types.constructor_arguments;cd_res : Ocaml_typing.Types.type_expr option;cd_loc : Ocaml_parsing.Location.t;cd_attributes : Ocaml_parsing.Parsetree.attributes;cd_uid : Uid.t;
}and constructor_argument = {ca_modalities : Ocaml_typing.Mode.Modality.Const.t;ca_type : Ocaml_typing.Types.type_expr;ca_sort : Ocaml_typing.Jkind_types.Sort.Const.t;ca_loc : Ocaml_parsing.Location.t;
}and constructor_arguments = | Cstr_tuple of Ocaml_typing.Types.constructor_argument list| Cstr_record of Ocaml_typing.Types.label_declaration list
val tys_of_constr_args :
Ocaml_typing.Types.constructor_arguments ->
Ocaml_typing.Types.type_expr listval find_unboxed_type :
Ocaml_typing.Types.type_declaration ->
(Ocaml_typing.Types.type_expr * Ocaml_typing.Mode.Modality.Const.t) optiontype extension_constructor = {ext_type_path : Ocaml_typing.Path.t;ext_type_params : Ocaml_typing.Types.type_expr list;ext_args : Ocaml_typing.Types.constructor_arguments;ext_shape : Ocaml_typing.Types.constructor_representation;ext_constant : bool;ext_ret_type : Ocaml_typing.Types.type_expr option;ext_private : Ocaml_parsing.Asttypes.private_flag;ext_loc : Ocaml_parsing.Location.t;ext_attributes : Ocaml_parsing.Parsetree.attributes;ext_uid : Uid.t;
}type class_type = | Cty_constr of Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list * Ocaml_typing.Types.class_type| Cty_signature of Ocaml_typing.Types.class_signature| Cty_arrow of Ocaml_typing.Types.arg_label * Ocaml_typing.Types.type_expr * Ocaml_typing.Types.class_type
type class_declaration = {cty_params : Ocaml_typing.Types.type_expr list;mutable cty_type : Ocaml_typing.Types.class_type;cty_path : Ocaml_typing.Path.t;cty_new : Ocaml_typing.Types.type_expr option;cty_variance : Ocaml_typing.Types.Variance.t list;cty_loc : Ocaml_parsing.Location.t;cty_attributes : Ocaml_parsing.Parsetree.attributes;cty_uid : Uid.t;
}type class_type_declaration = {clty_params : Ocaml_typing.Types.type_expr list;clty_type : Ocaml_typing.Types.class_type;clty_path : Ocaml_typing.Path.t;clty_hash_type : Ocaml_typing.Types.type_declaration;clty_variance : Ocaml_typing.Types.Variance.t list;clty_loc : Ocaml_parsing.Location.t;clty_attributes : Ocaml_parsing.Parsetree.attributes;clty_uid : Uid.t;
}module Aliasability : sig ... endmodule type Wrap = sig ... endmodule type Wrapped = sig ... endmodule Make_wrapped
(Wrap : Ocaml_typing.Types.Wrap) :
Ocaml_typing.Types.Wrapped with type 'a wrapped = 'a Wrap.tmodule Map_wrapped
(From : Ocaml_typing.Types.Wrapped)
(To : Ocaml_typing.Types.Wrapped) :
sig ... endinclude Ocaml_typing.Types.Wrapped with type 'a wrapped = 'a
type value_description = {val_type : Ocaml_typing.Types.type_expr Ocaml_typing.Types.wrapped;val_modalities : Ocaml_typing.Mode.Modality.t;val_kind : Ocaml_typing.Types.value_kind;val_loc : Ocaml_parsing.Location.t;val_zero_alloc : Ocaml_typing.Zero_alloc.t;val_attributes : Ocaml_parsing.Parsetree.attributes;val_uid : Uid.t;
}type module_type = | Mty_ident of Ocaml_typing.Path.t| Mty_signature of Ocaml_typing.Types.signature| Mty_functor of Ocaml_typing.Types.functor_parameter * Ocaml_typing.Types.module_type| Mty_alias of Ocaml_typing.Path.t| Mty_strengthen of Ocaml_typing.Types.module_type * Ocaml_typing.Path.t * Ocaml_typing.Types.Aliasability.t| Mty_for_hole
and functor_parameter = | Unit| Named of Ocaml_typing.Ident.t option * Ocaml_typing.Types.module_type
and signature =
Ocaml_typing.Types.signature_item list Ocaml_typing.Types.wrappedand signature_item = | Sig_value of Ocaml_typing.Ident.t * Ocaml_typing.Types.value_description * Ocaml_typing.Types.visibility| Sig_type of Ocaml_typing.Ident.t * Ocaml_typing.Types.type_declaration * Ocaml_typing.Types.rec_status * Ocaml_typing.Types.visibility| Sig_typext of Ocaml_typing.Ident.t * Ocaml_typing.Types.extension_constructor * Ocaml_typing.Types.ext_status * Ocaml_typing.Types.visibility| Sig_module of Ocaml_typing.Ident.t * Ocaml_typing.Types.module_presence * Ocaml_typing.Types.module_declaration * Ocaml_typing.Types.rec_status * Ocaml_typing.Types.visibility| Sig_modtype of Ocaml_typing.Ident.t * Ocaml_typing.Types.modtype_declaration * Ocaml_typing.Types.visibility| Sig_class of Ocaml_typing.Ident.t * Ocaml_typing.Types.class_declaration * Ocaml_typing.Types.rec_status * Ocaml_typing.Types.visibility| Sig_class_type of Ocaml_typing.Ident.t * Ocaml_typing.Types.class_type_declaration * Ocaml_typing.Types.rec_status * Ocaml_typing.Types.visibility
and module_declaration = {md_type : Ocaml_typing.Types.module_type;md_modalities : Ocaml_typing.Mode.Modality.t;md_attributes : Ocaml_parsing.Parsetree.attributes;md_loc : Ocaml_parsing.Location.t;md_uid : Uid.t;
}and modtype_declaration = {mtd_type : Ocaml_typing.Types.module_type option;mtd_attributes : Ocaml_parsing.Parsetree.attributes;mtd_loc : Ocaml_parsing.Location.t;mtd_uid : Uid.t;
}val sort_of_signature_item :
Ocaml_typing.Types.signature_item ->
Ocaml_typing.Jkind_types.Sort.t optionval item_visibility :
Ocaml_typing.Types.signature_item ->
Ocaml_typing.Types.visibilitytype constructor_description = {cstr_name : string;cstr_res : Ocaml_typing.Types.type_expr;cstr_existentials : Ocaml_typing.Types.type_expr list;cstr_args : Ocaml_typing.Types.constructor_argument list;cstr_arity : int;cstr_tag : Ocaml_typing.Types.tag;cstr_repr : Ocaml_typing.Types.variant_representation;cstr_shape : Ocaml_typing.Types.constructor_representation;cstr_constant : bool;cstr_consts : int;cstr_nonconsts : int;cstr_generalized : bool;cstr_private : Ocaml_parsing.Asttypes.private_flag;cstr_loc : Ocaml_parsing.Location.t;cstr_attributes : Ocaml_parsing.Parsetree.attributes;cstr_inlined : Ocaml_typing.Types.type_declaration option;cstr_uid : Uid.t;
}val equal_tag : Ocaml_typing.Types.tag -> Ocaml_typing.Types.tag -> boolval compare_tag : Ocaml_typing.Types.tag -> Ocaml_typing.Types.tag -> intval may_equal_constr :
Ocaml_typing.Types.constructor_description ->
Ocaml_typing.Types.constructor_description ->
boolval equal_record_representation :
Ocaml_typing.Types.record_representation ->
Ocaml_typing.Types.record_representation ->
boolval equal_record_unboxed_product_representation :
Ocaml_typing.Types.record_unboxed_product_representation ->
Ocaml_typing.Types.record_unboxed_product_representation ->
boolval equal_variant_representation :
Ocaml_typing.Types.variant_representation ->
Ocaml_typing.Types.variant_representation ->
booltype 'a gen_label_description = {lbl_name : string;lbl_res : Ocaml_typing.Types.type_expr;lbl_arg : Ocaml_typing.Types.type_expr;lbl_mut : Ocaml_typing.Types.mutability;lbl_modalities : Ocaml_typing.Mode.Modality.Const.t;lbl_sort : Ocaml_typing.Jkind_types.Sort.Const.t;lbl_pos : int;lbl_all : 'a Ocaml_typing.Types.gen_label_description array;lbl_repres : 'a;lbl_private : Ocaml_parsing.Asttypes.private_flag;lbl_loc : Ocaml_parsing.Location.t;lbl_attributes : Ocaml_parsing.Parsetree.attributes;lbl_uid : Uid.t;
}type label_description =
Ocaml_typing.Types.record_representation
Ocaml_typing.Types.gen_label_descriptiontype unboxed_label_description =
Ocaml_typing.Types.record_unboxed_product_representation
Ocaml_typing.Types.gen_label_descriptionThis type tracks the distinction between legacy records ({ field }) and unboxed records (#{ field }). Note that Legacy includes normal boxed records, as well as inlined and [@@unboxed] records.
As a GADT, it also lets us avoid duplicating functions that handle both record forms, such as Env.find_label_by_name, which has type 'rep record_form -> Longident.t -> Env.t -> 'rep gen_label_description.
val record_form_to_string : _ Ocaml_typing.Types.record_form -> stringval mixed_block_element_of_const_sort :
Ocaml_typing.Jkind_types.Sort.Const.t ->
Ocaml_typing.Types.mixed_block_elementval bound_value_identifiers :
Ocaml_typing.Types.signature ->
Ocaml_typing.Ident.t listExtracts the list of "value" identifiers bound by a signature. "Value" identifiers are identifiers for signature components that correspond to a run-time value: values, extensions, modules, classes. Note: manifest primitives do not correspond to a run-time value!
val bound_value_identifiers_and_sorts :
Ocaml_typing.Types.signature ->
(Ocaml_typing.Ident.t * Ocaml_typing.Jkind_types.Sort.t) listLike bound_value_identifiers, but also return sorts
val signature_item_id :
Ocaml_typing.Types.signature_item ->
Ocaml_typing.Ident.tval equal_mixed_block_element :
Ocaml_typing.Types.mixed_block_element ->
Ocaml_typing.Types.mixed_block_element ->
boolval compare_mixed_block_element :
Ocaml_typing.Types.mixed_block_element ->
Ocaml_typing.Types.mixed_block_element ->
intval mixed_block_element_to_string :
Ocaml_typing.Types.mixed_block_element ->
stringval mixed_block_element_to_lowercase_string :
Ocaml_typing.Types.mixed_block_element ->
stringval equal_unsafe_mode_crossing :
type_equal:
(Ocaml_typing.Types.type_expr -> Ocaml_typing.Types.type_expr -> bool) ->
Ocaml_typing.Types.unsafe_mode_crossing ->
Ocaml_typing.Types.unsafe_mode_crossing ->
boolval snapshot : unit -> Ocaml_typing.Types.snapshotval backtrack :
cleanup_abbrev:(unit -> unit) ->
Ocaml_typing.Types.snapshot ->
unitval undo_first_change_after : Ocaml_typing.Types.snapshot -> unitval undo_compress : Ocaml_typing.Types.snapshot -> unitFunctions to use when modifying a type (only Ctype?). The old values are logged and reverted on backtracking.
val link_type :
Ocaml_typing.Types.type_expr ->
Ocaml_typing.Types.type_expr ->
unitval set_type_desc :
Ocaml_typing.Types.type_expr ->
Ocaml_typing.Types.type_desc ->
unitval set_level : Ocaml_typing.Types.type_expr -> int -> unitval set_scope : Ocaml_typing.Types.type_expr -> int -> unitval set_var_jkind :
Ocaml_typing.Types.type_expr ->
Ocaml_typing.Types.jkind_lr ->
unitval set_name :
(Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) option Stdlib.ref ->
(Ocaml_typing.Path.t * Ocaml_typing.Types.type_expr list) option ->
unitval link_row_field_ext :
inside:Ocaml_typing.Types.row_field ->
Ocaml_typing.Types.row_field ->
unitval set_univar :
Ocaml_typing.Types.type_expr option Stdlib.ref ->
Ocaml_typing.Types.type_expr ->
unitval link_kind :
inside:Ocaml_typing.Types.field_kind ->
Ocaml_typing.Types.field_kind ->
unitval link_commu :
inside:Ocaml_typing.Types.commutable ->
Ocaml_typing.Types.commutable ->
unitval set_commu_ok : Ocaml_typing.Types.commutable -> unitval functor_param_mode : Ocaml_typing.Mode.Alloc.lrval functor_res_mode : Ocaml_typing.Mode.Alloc.lrval is_valid : Ocaml_typing.Types.snapshot -> boolcheck if a snapshot has been invalidated