Module Ocaml_typing.Typedtree
Abstract syntax tree after typing
By comparison with Parsetree:
- Every
Longindent.tis accompanied by a resolvedPath.t.
module Uid = Ocaml_typing.Shape.UidExtension points
type attribute = Ocaml_parsing.Parsetree.attributetype attributes = Ocaml_typing.Typedtree.attribute listCore language
and 'k general_pattern =
'k Ocaml_typing.Typedtree.pattern_desc Ocaml_typing.Typedtree.pattern_dataand 'a pattern_data = {pat_desc : 'a;pat_loc : Ocaml_parsing.Location.t;pat_extra : (Ocaml_typing.Typedtree.pat_extra * Ocaml_parsing.Location.t * Ocaml_typing.Typedtree.attributes) list;pat_type : Ocaml_typing.Types.type_expr;pat_env : Ocaml_typing.Env.t;pat_attributes : Ocaml_typing.Typedtree.attributes;
}and pat_extra = | Tpat_constraint of Ocaml_typing.Typedtree.core_type(*P : T
*)pat_desc = P ; pat_extra = (Tpat_constraint T, _, _) :: ...| Tpat_type of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc(*#tconst
pat_desc = disjunction ; pat_extra = (Tpat_type (P, "tconst"), _, _) :: ...where
*)disjunctionis aTpat_or _representing the branches oftconst.| Tpat_open of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Env.t| Tpat_unpack(*(module P)
*)pat_desc = Tpat_var "P" ; pat_extra = (Tpat_unpack, _, _) :: ...(module _)pat_desc = Tpat_any ; pat_extra = (Tpat_unpack, _, _) :: ...
and 'k pattern_desc = | Tpat_any : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*_
*)| Tpat_var : Ocaml_typing.Ident.t * string Ocaml_parsing.Asttypes.loc * Uid.t -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*x
*)| Tpat_alias : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern * Ocaml_typing.Ident.t * string Ocaml_parsing.Asttypes.loc * Uid.t * Ocaml_typing.Types.type_expr -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*P as a
*)| Tpat_constant : Ocaml_parsing.Asttypes.constant -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*1, 'a', "true", 1.0, 1l, 1L, 1n
*)| Tpat_tuple : (string option * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern) list -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*(P1, ..., Pn)
(None,P1); ...; (None,Pn)) (L1:P1, ... Ln:Pn)(Some L1,P1); ...; (Some Ln,Pn)) Any mix, e.g. (L1:P1, P2)(Some L1,P1); ...; (None,P2))Invariant: n >= 2
*)| Tpat_construct : Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.constructor_description * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern list * (Ocaml_typing.Ident.t Ocaml_parsing.Asttypes.loc list * Ocaml_typing.Typedtree.core_type) option -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*C (, None) C P (
*)P, None) C (P1, ..., Pn) (P1; ...; Pn, None) C (P : t) (P, Some (, t)) C (P1, ..., Pn : t) (P1; ...; Pn, Some (, t)) C (type a) (P : t) (P, Some (a, t)) C (type a) (P1, ..., Pn : t) (P1; ...; Pn, Some (a, t))| Tpat_variant : Ocaml_parsing.Asttypes.label * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern option * Ocaml_typing.Types.row_desc Stdlib.ref -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc| Tpat_record : (Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.label_description * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern) list * Ocaml_parsing.Asttypes.closed_flag -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*l1=P1; ...; ln=Pn(flag = Closed)l1=P1; ...; ln=Pn; _(flag = Open)Invariant: n > 0
*)| Tpat_array : Ocaml_parsing.Asttypes.mutable_flag * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern list -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*
*)| P1; ...; Pn || Tpat_lazy : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc(*lazy P
*)| Tpat_value : Ocaml_typing.Typedtree.tpat_value_argument -> Ocaml_typing.Typedtree.computation Ocaml_typing.Typedtree.pattern_desc(*P
Invariant: Tpat_value pattern should not carry pat_attributes or pat_extra metadata coming from user syntax, which must be on the inner pattern node -- to facilitate searching for a certain value pattern constructor with a specific attributed.
To enforce this restriction, we made the argument of the Tpat_value constructor a private synonym of
*)pattern, requiring you to use theas_computation_patternfunction below instead of using theTpat_valueconstructor directly.| Tpat_exception : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern -> Ocaml_typing.Typedtree.computation Ocaml_typing.Typedtree.pattern_desc(*exception P
*)| Tpat_or : 'k Ocaml_typing.Typedtree.general_pattern * 'k Ocaml_typing.Typedtree.general_pattern * Ocaml_typing.Types.row_desc option -> 'k Ocaml_typing.Typedtree.pattern_desc(*P1 | P2
*)row_desc=Some _when translatingPpat_type _,Noneotherwise.
and tpat_value_argument =
private Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_patternand expression = {exp_desc : Ocaml_typing.Typedtree.expression_desc;exp_loc : Ocaml_parsing.Location.t;exp_extra : (Ocaml_typing.Typedtree.exp_extra * Ocaml_parsing.Location.t * Ocaml_typing.Typedtree.attributes) list;exp_type : Ocaml_typing.Types.type_expr;exp_env : Ocaml_typing.Env.t;exp_attributes : Ocaml_typing.Typedtree.attributes;
}and exp_extra = | Texp_constraint of Ocaml_typing.Typedtree.core_type(*E : T
*)| Texp_coerce of Ocaml_typing.Typedtree.core_type option * Ocaml_typing.Typedtree.core_type(*E :> T
*)Texp_coerce (None, T)E : T0 :> TTexp_coerce (Some T0, T)| Texp_poly of Ocaml_typing.Typedtree.core_type option(*Used for method bodies.
*)| Texp_newtype of string(*fun (type t) ->
*)| Texp_newtype' of Ocaml_typing.Ident.t * Ocaml_parsing.Asttypes.label Ocaml_parsing.Asttypes.loc * Uid.t(*merlin-specific: keep enough information to correctly implement occurrences for local-types. Merlin typechecker uses
*)Texp_newtype'constructor, while upstream OCaml still usesTexp_newtype. Those can appear when unmarshaling cmt files. By adding a new constructor, we can still safely uses these.
and expression_desc = | Texp_ident of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Types.value_description(*x M.x
*)| Texp_constant of Ocaml_parsing.Asttypes.constant(*1, 'a', "true", 1.0, 1l, 1L, 1n
*)| Texp_let of Ocaml_parsing.Asttypes.rec_flag * Ocaml_typing.Typedtree.value_binding list * Ocaml_typing.Typedtree.expression(*let P1 = E1 and ... and Pn = EN in E (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN in E (flag = Recursive)
*)| Texp_function of Ocaml_typing.Typedtree.function_param list * Ocaml_typing.Typedtree.function_body(*fun P0 P1 -> function p1 -> e1 | p2 -> e2 (body = Tfunction_cases _) fun P0 P1 -> E (body = Tfunction_body _)
This construct has the same arity as the originating
*)Pexp_function. Arity determines when side-effects for effectful parameters are run (e.g. optional argument defaults, matching against lazy patterns). Parameters' effects are run left-to-right when an n-ary function is saturated with n arguments.| Texp_apply of Ocaml_typing.Typedtree.expression * (Ocaml_parsing.Asttypes.arg_label * Ocaml_typing.Typedtree.apply_arg) list(*E0 ~l1:E1 ... ~ln:En
The expression can be Omitted if the expression is abstracted over this argument. It currently appears when a label is applied.
For example: let f x ~y = x + y in f ~y:3
The resulting typedtree for the application is: Texp_apply (Texp_ident "f/1037",
*)(Nolabel, Omitted ()); (Labelled "y", Arg (Texp_constant Const_int 3)))| Texp_match of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.computation Ocaml_typing.Typedtree.case list * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case list * Ocaml_typing.Typedtree.partial(*match E0 with | P1 -> E1 | P2 | exception P3 -> E2 | exception P4 -> E3 | effect P4 k -> E4
*)Texp_match (E0, [(P1, E1); (P2 | exception P3, E2); (exception P4, E3)], [(P4, E4)], _)| Texp_try of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case list * Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case list(*try E with | P1 -> E1 | effect P2 k -> E2
*)Texp_try (E, [(P1, E1)], [(P2, E2)])| Texp_tuple of (string option * Ocaml_typing.Typedtree.expression) list(*Texp_tuple(el)represents(E1, ..., En)whenelis(None, E1);...;(None, En),(L1:E1, ..., Ln:En)whenelis(Some L1, E1);...;(Some Ln, En),- Any mix, e.g.
(L1: E1, E2)whenelis(Some L1, E1); (None, E2)
| Texp_construct of Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.constructor_description * Ocaml_typing.Typedtree.expression list(*C C E
*)EC (E1, ..., En)E1;...;En| Texp_variant of Ocaml_parsing.Asttypes.label * Ocaml_typing.Typedtree.expression option| Texp_record of {fields : (Ocaml_typing.Data_types.label_description * Ocaml_typing.Typedtree.record_label_definition) array;representation : Ocaml_typing.Types.record_representation;extended_expression : Ocaml_typing.Typedtree.expression option;
}(*l1=P1; ...; ln=Pn(extended_expression = None)E0 with l1=P1; ...; ln=Pn(extended_expression = Some E0)Invariant: n > 0
If the type is
*)l1: t1; l2: t2, the expressionE0 with t2=P2is represented as Texp_recordfields = [| l1, Kept t1; l2 Override P2 |]; representation; extended_expression = Some E0| Texp_atomic_loc of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.label_description| Texp_field of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.label_description| Texp_setfield of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.label_description * Ocaml_typing.Typedtree.expression| Texp_array of Ocaml_parsing.Asttypes.mutable_flag * Ocaml_typing.Typedtree.expression list| Texp_ifthenelse of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression option| Texp_sequence of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression| Texp_while of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression| Texp_for of Ocaml_typing.Ident.t * Ocaml_parsing.Parsetree.pattern * Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression * Ocaml_parsing.Asttypes.direction_flag * Ocaml_typing.Typedtree.expression| Texp_send of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.meth| Texp_new of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Types.class_declaration| Texp_instvar of Ocaml_typing.Path.t * Ocaml_typing.Path.t * string Ocaml_parsing.Asttypes.loc| Texp_setinstvar of Ocaml_typing.Path.t * Ocaml_typing.Path.t * string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.expression| Texp_override of Ocaml_typing.Path.t * (Ocaml_typing.Ident.t * string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.expression) list| Texp_letmodule of Ocaml_typing.Ident.t option * string option Ocaml_parsing.Asttypes.loc * Ocaml_typing.Types.module_presence * Ocaml_typing.Typedtree.module_expr * Ocaml_typing.Typedtree.expression| Texp_letexception of Ocaml_typing.Typedtree.extension_constructor * Ocaml_typing.Typedtree.expression| Texp_assert of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Location.t| Texp_lazy of Ocaml_typing.Typedtree.expression| Texp_object of Ocaml_typing.Typedtree.class_structure * string list| Texp_pack of Ocaml_typing.Typedtree.module_expr| Texp_letop of {let_ : Ocaml_typing.Typedtree.binding_op;ands : Ocaml_typing.Typedtree.binding_op list;param : Ocaml_typing.Ident.t;body : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case;partial : Ocaml_typing.Typedtree.partial;
}| Texp_unreachable| Texp_extension_constructor of Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Path.t| Texp_open of Ocaml_typing.Typedtree.open_declaration * Ocaml_typing.Typedtree.expression(*let open
*)!M in e| Texp_typed_hole
and meth = | Tmeth_name of string| Tmeth_val of Ocaml_typing.Ident.t| Tmeth_ancestor of Ocaml_typing.Ident.t * Ocaml_typing.Path.t
and 'k case = {c_lhs : 'k Ocaml_typing.Typedtree.general_pattern;c_cont : (Ocaml_typing.Ident.t * Ocaml_typing.Types.value_description) option;c_guard : Ocaml_typing.Typedtree.expression option;c_rhs : Ocaml_typing.Typedtree.expression;
}and function_param = {fp_arg_label : Ocaml_parsing.Asttypes.arg_label;fp_param : Ocaml_typing.Ident.t;(*
*)fp_paramis the identifier that is to be used to name the parameter of the function.fp_partial : Ocaml_typing.Typedtree.partial;(*
*)fp_partial=Partialif the pattern match is partialTotalotherwise.fp_kind : Ocaml_typing.Typedtree.function_param_kind;fp_newtypes : string Ocaml_parsing.Asttypes.loc list;(*
*)fp_newtypesare the new type declarations that come *after* that parameter. The newtypes that come before the first parameter are placed as exp_extras on the Texp_function node. This is just used inUntypeast.fp_loc : Ocaml_parsing.Location.t;(*
*)fp_locis the location of the entire value parameter, not including thefp_newtypes.
}and function_param_kind = | Tparam_pat of Ocaml_typing.Typedtree.pattern(*
*)Tparam_pat pis a non-optional argument with patternp.| Tparam_optional_default of Ocaml_typing.Typedtree.pattern * Ocaml_typing.Typedtree.expression(*
*)Tparam_optional_default (p, e)is an optional argumentpwith default valuee, i.e.?x:(p = e). If the parameter is of typea option, the pattern and expression are of typea.
and function_body = | Tfunction_body of Ocaml_typing.Typedtree.expression| Tfunction_cases of {cases : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case list;partial : Ocaml_typing.Typedtree.partial;param : Ocaml_typing.Ident.t;loc : Ocaml_parsing.Location.t;exp_extra : Ocaml_typing.Typedtree.exp_extra option;attributes : Ocaml_typing.Typedtree.attributes;(*
*)attributesis just used in untypeast.
}(*The function body binds a final argument in
*)Tfunction_cases, and this argument is pattern-matched against the cases.
and binding_op = {bop_op_path : Ocaml_typing.Path.t;bop_op_name : string Ocaml_parsing.Asttypes.loc;bop_op_val : Ocaml_typing.Types.value_description;bop_op_type : Ocaml_typing.Types.type_expr;bop_exp : Ocaml_typing.Typedtree.expression;bop_loc : Ocaml_parsing.Location.t;
}and apply_arg =
(Ocaml_typing.Typedtree.expression, unit)
Ocaml_typing.Typedtree.arg_or_omittedand class_expr = {cl_desc : Ocaml_typing.Typedtree.class_expr_desc;cl_loc : Ocaml_parsing.Location.t;cl_type : Ocaml_typing.Types.class_type;cl_env : Ocaml_typing.Env.t;cl_attributes : Ocaml_typing.Typedtree.attributes;
}and class_expr_desc = | Tcl_ident of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type list| Tcl_structure of Ocaml_typing.Typedtree.class_structure| Tcl_fun of Ocaml_parsing.Asttypes.arg_label * Ocaml_typing.Typedtree.pattern * (Ocaml_typing.Ident.t * Ocaml_typing.Typedtree.expression) list * Ocaml_typing.Typedtree.class_expr * Ocaml_typing.Typedtree.partial| Tcl_apply of Ocaml_typing.Typedtree.class_expr * (Ocaml_parsing.Asttypes.arg_label * Ocaml_typing.Typedtree.apply_arg) list| Tcl_let of Ocaml_parsing.Asttypes.rec_flag * Ocaml_typing.Typedtree.value_binding list * (Ocaml_typing.Ident.t * Ocaml_typing.Typedtree.expression) list * Ocaml_typing.Typedtree.class_expr| Tcl_constraint of Ocaml_typing.Typedtree.class_expr * Ocaml_typing.Typedtree.class_type option * string list * string list * Ocaml_typing.Types.MethSet.t| Tcl_open of Ocaml_typing.Typedtree.open_description * Ocaml_typing.Typedtree.class_expr
and class_structure = {cstr_self : Ocaml_typing.Typedtree.pattern;cstr_fields : Ocaml_typing.Typedtree.class_field list;cstr_type : Ocaml_typing.Types.class_signature;cstr_meths : Ocaml_typing.Ident.t Ocaml_typing.Types.Meths.t;
}and class_field = {cf_desc : Ocaml_typing.Typedtree.class_field_desc;cf_loc : Ocaml_parsing.Location.t;cf_attributes : Ocaml_typing.Typedtree.attributes;
}and class_field_kind = | Tcfk_virtual of Ocaml_typing.Typedtree.core_type| Tcfk_concrete of Ocaml_parsing.Asttypes.override_flag * Ocaml_typing.Typedtree.expression
and class_field_desc = | Tcf_inherit of Ocaml_parsing.Asttypes.override_flag * Ocaml_typing.Typedtree.class_expr * string option * (string * Ocaml_typing.Ident.t) list * (string * Ocaml_typing.Ident.t) list| Tcf_val of string Ocaml_parsing.Asttypes.loc * Ocaml_parsing.Asttypes.mutable_flag * Ocaml_typing.Ident.t * Ocaml_typing.Typedtree.class_field_kind * bool| Tcf_method of string Ocaml_parsing.Asttypes.loc * Ocaml_parsing.Asttypes.private_flag * Ocaml_typing.Typedtree.class_field_kind| Tcf_constraint of Ocaml_typing.Typedtree.core_type * Ocaml_typing.Typedtree.core_type| Tcf_initializer of Ocaml_typing.Typedtree.expression| Tcf_attribute of Ocaml_typing.Typedtree.attribute
and module_expr = {mod_desc : Ocaml_typing.Typedtree.module_expr_desc;mod_loc : Ocaml_parsing.Location.t;mod_type : Ocaml_typing.Types.module_type;mod_env : Ocaml_typing.Env.t;mod_attributes : Ocaml_typing.Typedtree.attributes;
}and module_type_constraint = | Tmodtype_implicit(*The module type constraint has been synthesized during typechecking.
*)| Tmodtype_explicit of Ocaml_typing.Typedtree.module_type(*The module type was in the source file.
*)
Annotations for Tmod_constraint.
and functor_parameter = | Unit| Named of Ocaml_typing.Ident.t option * string option Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.module_type
and module_expr_desc = | Tmod_ident of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc| Tmod_structure of Ocaml_typing.Typedtree.structure| Tmod_functor of Ocaml_typing.Typedtree.functor_parameter * Ocaml_typing.Typedtree.module_expr| Tmod_apply of Ocaml_typing.Typedtree.module_expr * Ocaml_typing.Typedtree.module_expr * Ocaml_typing.Typedtree.module_coercion| Tmod_apply_unit of Ocaml_typing.Typedtree.module_expr| Tmod_constraint of Ocaml_typing.Typedtree.module_expr * Ocaml_typing.Types.module_type * Ocaml_typing.Typedtree.module_type_constraint * Ocaml_typing.Typedtree.module_coercion(*ME (constraint = Tmodtype_implicit) (ME : MT) (constraint = Tmodtype_explicit MT)
*)| Tmod_unpack of Ocaml_typing.Typedtree.expression * Ocaml_typing.Types.module_type| Tmod_typed_hole
and structure = {str_items : Ocaml_typing.Typedtree.structure_item list;str_type : Ocaml_typing.Types.signature;str_final_env : Ocaml_typing.Env.t;
}and structure_item = {str_desc : Ocaml_typing.Typedtree.structure_item_desc;str_loc : Ocaml_parsing.Location.t;str_env : Ocaml_typing.Env.t;
}and structure_item_desc = | Tstr_eval of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.attributes| Tstr_value of Ocaml_parsing.Asttypes.rec_flag * Ocaml_typing.Typedtree.value_binding list| Tstr_primitive of Ocaml_typing.Typedtree.value_description| Tstr_type of Ocaml_parsing.Asttypes.rec_flag * Ocaml_typing.Typedtree.type_declaration list| Tstr_typext of Ocaml_typing.Typedtree.type_extension| Tstr_exception of Ocaml_typing.Typedtree.type_exception| Tstr_module of Ocaml_typing.Typedtree.module_binding| Tstr_recmodule of Ocaml_typing.Typedtree.module_binding list| Tstr_modtype of Ocaml_typing.Typedtree.module_type_declaration| Tstr_open of Ocaml_typing.Typedtree.open_declaration| Tstr_class of (Ocaml_typing.Typedtree.class_declaration * string list) list| Tstr_class_type of (Ocaml_typing.Ident.t * string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.class_type_declaration) list| Tstr_include of Ocaml_typing.Typedtree.include_declaration| Tstr_attribute of Ocaml_typing.Typedtree.attribute
and module_binding = {mb_id : Ocaml_typing.Ident.t option;(*
*)Noneformodule _ = struct ... endmb_name : string option Ocaml_parsing.Asttypes.loc;mb_uid : Uid.t;mb_presence : Ocaml_typing.Types.module_presence;mb_expr : Ocaml_typing.Typedtree.module_expr;mb_attributes : Ocaml_typing.Typedtree.attributes;mb_loc : Ocaml_parsing.Location.t;
}and value_binding = {vb_pat : Ocaml_typing.Typedtree.pattern;vb_expr : Ocaml_typing.Typedtree.expression;vb_rec_kind : Ocaml_typing.Value_rec_types.recursive_binding_kind;vb_attributes : Ocaml_typing.Typedtree.attributes;vb_loc : Ocaml_parsing.Location.t;
}and module_coercion = | Tcoerce_none| Tcoerce_structure of (int * Ocaml_typing.Typedtree.module_coercion) list * (Ocaml_typing.Ident.t * int * Ocaml_typing.Typedtree.module_coercion) list| Tcoerce_functor of Ocaml_typing.Typedtree.module_coercion * Ocaml_typing.Typedtree.module_coercion| Tcoerce_primitive of Ocaml_typing.Typedtree.primitive_coercion(*External declaration coerced to a regular value.
module M : sig val ext : a -> b end = struct external ext : a -> b = "my_c_function" endOnly occurs inside a
*)Tcoerce_structurecoercion.| Tcoerce_alias of Ocaml_typing.Env.t * Ocaml_typing.Path.t * Ocaml_typing.Typedtree.module_coercion(*Module alias coerced to a regular module.
module M : sig module Sub : T end = struct module Sub = Some_alias endOnly occurs inside a
*)Tcoerce_structurecoercion.
and module_type = {mty_desc : Ocaml_typing.Typedtree.module_type_desc;mty_type : Ocaml_typing.Types.module_type;mty_env : Ocaml_typing.Env.t;mty_loc : Ocaml_parsing.Location.t;mty_attributes : Ocaml_typing.Typedtree.attributes;
}and module_type_desc = | Tmty_ident of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc| Tmty_signature of Ocaml_typing.Typedtree.signature| Tmty_functor of Ocaml_typing.Typedtree.functor_parameter * Ocaml_typing.Typedtree.module_type| Tmty_with of Ocaml_typing.Typedtree.module_type * (Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.with_constraint) list| Tmty_typeof of Ocaml_typing.Typedtree.module_expr| Tmty_alias of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc
and primitive_coercion = {pc_desc : Ocaml_typing.Primitive.description;pc_type : Ocaml_typing.Types.type_expr;pc_env : Ocaml_typing.Env.t;pc_loc : Ocaml_parsing.Location.t;
}and signature = {sig_items : Ocaml_typing.Typedtree.signature_item list;sig_type : Ocaml_typing.Types.signature;sig_final_env : Ocaml_typing.Env.t;
}and signature_item = {sig_desc : Ocaml_typing.Typedtree.signature_item_desc;sig_env : Ocaml_typing.Env.t;sig_loc : Ocaml_parsing.Location.t;
}and signature_item_desc = | Tsig_value of Ocaml_typing.Typedtree.value_description| Tsig_type of Ocaml_parsing.Asttypes.rec_flag * Ocaml_typing.Typedtree.type_declaration list| Tsig_typesubst of Ocaml_typing.Typedtree.type_declaration list| Tsig_typext of Ocaml_typing.Typedtree.type_extension| Tsig_exception of Ocaml_typing.Typedtree.type_exception| Tsig_module of Ocaml_typing.Typedtree.module_declaration| Tsig_modsubst of Ocaml_typing.Typedtree.module_substitution| Tsig_recmodule of Ocaml_typing.Typedtree.module_declaration list| Tsig_modtype of Ocaml_typing.Typedtree.module_type_declaration| Tsig_modtypesubst of Ocaml_typing.Typedtree.module_type_declaration| Tsig_open of Ocaml_typing.Typedtree.open_description| Tsig_include of Ocaml_typing.Typedtree.include_description| Tsig_class of Ocaml_typing.Typedtree.class_description list| Tsig_class_type of Ocaml_typing.Typedtree.class_type_declaration list| Tsig_attribute of Ocaml_typing.Typedtree.attribute
and module_declaration = {md_id : Ocaml_typing.Ident.t option;md_name : string option Ocaml_parsing.Asttypes.loc;md_uid : Uid.t;md_presence : Ocaml_typing.Types.module_presence;md_type : Ocaml_typing.Typedtree.module_type;md_attributes : Ocaml_typing.Typedtree.attributes;md_loc : Ocaml_parsing.Location.t;
}and module_substitution = {ms_id : Ocaml_typing.Ident.t;ms_name : string Ocaml_parsing.Asttypes.loc;ms_uid : Uid.t;ms_manifest : Ocaml_typing.Path.t;ms_txt : Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc;ms_attributes : Ocaml_typing.Typedtree.attributes;ms_loc : Ocaml_parsing.Location.t;
}and module_type_declaration = {mtd_id : Ocaml_typing.Ident.t;mtd_name : string Ocaml_parsing.Asttypes.loc;mtd_uid : Uid.t;mtd_type : Ocaml_typing.Typedtree.module_type option;mtd_attributes : Ocaml_typing.Typedtree.attributes;mtd_loc : Ocaml_parsing.Location.t;
}and 'a open_infos = {open_expr : 'a;open_bound_items : Ocaml_typing.Types.signature;open_override : Ocaml_parsing.Asttypes.override_flag;open_env : Ocaml_typing.Env.t;open_loc : Ocaml_parsing.Location.t;open_attributes : Ocaml_typing.Typedtree.attribute list;
}and open_description =
(Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc)
Ocaml_typing.Typedtree.open_infosand open_declaration =
Ocaml_typing.Typedtree.module_expr Ocaml_typing.Typedtree.open_infosand 'a include_infos = {incl_mod : 'a;incl_type : Ocaml_typing.Types.signature;incl_loc : Ocaml_parsing.Location.t;incl_attributes : Ocaml_typing.Typedtree.attribute list;
}and include_description =
Ocaml_typing.Typedtree.module_type Ocaml_typing.Typedtree.include_infosand include_declaration =
Ocaml_typing.Typedtree.module_expr Ocaml_typing.Typedtree.include_infosand with_constraint = | Twith_type of Ocaml_typing.Typedtree.type_declaration| Twith_module of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc| Twith_modtype of Ocaml_typing.Typedtree.module_type| Twith_typesubst of Ocaml_typing.Typedtree.type_declaration| Twith_modsubst of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc| Twith_modtypesubst of Ocaml_typing.Typedtree.module_type
and core_type = {mutable ctyp_desc : Ocaml_typing.Typedtree.core_type_desc;(*mutable because of
*)Typeclass.declare_methodmutable ctyp_type : Ocaml_typing.Types.type_expr;(*mutable because of
*)Typeclass.declare_methodctyp_env : Ocaml_typing.Env.t;ctyp_loc : Ocaml_parsing.Location.t;ctyp_attributes : Ocaml_typing.Typedtree.attributes;
}and core_type_desc = | Ttyp_any| Ttyp_var of string| Ttyp_arrow of Ocaml_parsing.Asttypes.arg_label * Ocaml_typing.Typedtree.core_type * Ocaml_typing.Typedtree.core_type| Ttyp_tuple of (string option * Ocaml_typing.Typedtree.core_type) list| Ttyp_constr of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type list| Ttyp_object of Ocaml_typing.Typedtree.object_field list * Ocaml_parsing.Asttypes.closed_flag| Ttyp_class of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type list| Ttyp_alias of Ocaml_typing.Typedtree.core_type * string Ocaml_parsing.Asttypes.loc| Ttyp_variant of Ocaml_typing.Typedtree.row_field list * Ocaml_parsing.Asttypes.closed_flag * Ocaml_parsing.Asttypes.label list option| Ttyp_poly of string list * Ocaml_typing.Typedtree.core_type| Ttyp_package of Ocaml_typing.Typedtree.package_type| Ttyp_open of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type
and package_type = {tpt_path : Ocaml_typing.Path.t;tpt_cstrs : (Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type) list;tpt_type : Ocaml_typing.Types.module_type;tpt_txt : Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc;
}and row_field = {rf_desc : Ocaml_typing.Typedtree.row_field_desc;rf_loc : Ocaml_parsing.Location.t;rf_attributes : Ocaml_typing.Typedtree.attributes;
}and row_field_desc = | Ttag of string Ocaml_parsing.Asttypes.loc * bool * Ocaml_typing.Typedtree.core_type list| Tinherit of Ocaml_typing.Typedtree.core_type
and object_field = {of_desc : Ocaml_typing.Typedtree.object_field_desc;of_loc : Ocaml_parsing.Location.t;of_attributes : Ocaml_typing.Typedtree.attributes;
}and object_field_desc = | OTtag of string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type| OTinherit of Ocaml_typing.Typedtree.core_type
and value_description = {val_id : Ocaml_typing.Ident.t;val_name : string Ocaml_parsing.Asttypes.loc;val_desc : Ocaml_typing.Typedtree.core_type;val_val : Ocaml_typing.Types.value_description;val_prim : string list;val_loc : Ocaml_parsing.Location.t;val_attributes : Ocaml_typing.Typedtree.attributes;
}and type_declaration = {typ_id : Ocaml_typing.Ident.t;typ_name : string Ocaml_parsing.Asttypes.loc;typ_params : (Ocaml_typing.Typedtree.core_type * (Ocaml_parsing.Asttypes.variance * Ocaml_parsing.Asttypes.injectivity)) list;typ_type : Ocaml_typing.Types.type_declaration;typ_cstrs : (Ocaml_typing.Typedtree.core_type * Ocaml_typing.Typedtree.core_type * Ocaml_parsing.Location.t) list;typ_kind : Ocaml_typing.Typedtree.type_kind;typ_private : Ocaml_parsing.Asttypes.private_flag;typ_manifest : Ocaml_typing.Typedtree.core_type option;typ_loc : Ocaml_parsing.Location.t;typ_attributes : Ocaml_typing.Typedtree.attributes;
}and type_kind = | Ttype_abstract| Ttype_variant of Ocaml_typing.Typedtree.constructor_declaration list| Ttype_record of Ocaml_typing.Typedtree.label_declaration list| Ttype_open
and label_declaration = {ld_id : Ocaml_typing.Ident.t;ld_name : string Ocaml_parsing.Asttypes.loc;ld_uid : Uid.t;ld_mutable : Ocaml_parsing.Asttypes.mutable_flag;ld_atomic : Ocaml_parsing.Asttypes.atomic_flag;ld_type : Ocaml_typing.Typedtree.core_type;ld_loc : Ocaml_parsing.Location.t;ld_attributes : Ocaml_typing.Typedtree.attributes;
}and constructor_declaration = {cd_id : Ocaml_typing.Ident.t;cd_name : string Ocaml_parsing.Asttypes.loc;cd_uid : Uid.t;cd_vars : string Ocaml_parsing.Asttypes.loc list;cd_args : Ocaml_typing.Typedtree.constructor_arguments;cd_res : Ocaml_typing.Typedtree.core_type option;cd_loc : Ocaml_parsing.Location.t;cd_attributes : Ocaml_typing.Typedtree.attributes;
}and constructor_arguments = | Cstr_tuple of Ocaml_typing.Typedtree.core_type list| Cstr_record of Ocaml_typing.Typedtree.label_declaration list
and type_extension = {tyext_path : Ocaml_typing.Path.t;tyext_txt : Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc;tyext_params : (Ocaml_typing.Typedtree.core_type * (Ocaml_parsing.Asttypes.variance * Ocaml_parsing.Asttypes.injectivity)) list;tyext_constructors : Ocaml_typing.Typedtree.extension_constructor list;tyext_private : Ocaml_parsing.Asttypes.private_flag;tyext_loc : Ocaml_parsing.Location.t;tyext_attributes : Ocaml_typing.Typedtree.attributes;
}and type_exception = {tyexn_constructor : Ocaml_typing.Typedtree.extension_constructor;tyexn_loc : Ocaml_parsing.Location.t;tyexn_attributes : Ocaml_typing.Typedtree.attribute list;
}and extension_constructor = {ext_id : Ocaml_typing.Ident.t;ext_name : string Ocaml_parsing.Asttypes.loc;ext_type : Ocaml_typing.Types.extension_constructor;ext_kind : Ocaml_typing.Typedtree.extension_constructor_kind;ext_loc : Ocaml_parsing.Location.t;ext_attributes : Ocaml_typing.Typedtree.attributes;
}and extension_constructor_kind = | Text_decl of string Ocaml_parsing.Asttypes.loc list * Ocaml_typing.Typedtree.constructor_arguments * Ocaml_typing.Typedtree.core_type option| Text_rebind of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc
and class_type = {cltyp_desc : Ocaml_typing.Typedtree.class_type_desc;cltyp_type : Ocaml_typing.Types.class_type;cltyp_env : Ocaml_typing.Env.t;cltyp_loc : Ocaml_parsing.Location.t;cltyp_attributes : Ocaml_typing.Typedtree.attributes;
}and class_type_desc = | Tcty_constr of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type list| Tcty_signature of Ocaml_typing.Typedtree.class_signature| Tcty_arrow of Ocaml_parsing.Asttypes.arg_label * Ocaml_typing.Typedtree.core_type * Ocaml_typing.Typedtree.class_type| Tcty_open of Ocaml_typing.Typedtree.open_description * Ocaml_typing.Typedtree.class_type
and class_signature = {csig_self : Ocaml_typing.Typedtree.core_type;csig_fields : Ocaml_typing.Typedtree.class_type_field list;csig_type : Ocaml_typing.Types.class_signature;
}and class_type_field = {ctf_desc : Ocaml_typing.Typedtree.class_type_field_desc;ctf_loc : Ocaml_parsing.Location.t;ctf_attributes : Ocaml_typing.Typedtree.attributes;
}and class_type_field_desc = | Tctf_inherit of Ocaml_typing.Typedtree.class_type| Tctf_val of string * Ocaml_parsing.Asttypes.mutable_flag * Ocaml_parsing.Asttypes.virtual_flag * Ocaml_typing.Typedtree.core_type| Tctf_method of string * Ocaml_parsing.Asttypes.private_flag * Ocaml_parsing.Asttypes.virtual_flag * Ocaml_typing.Typedtree.core_type| Tctf_constraint of Ocaml_typing.Typedtree.core_type * Ocaml_typing.Typedtree.core_type| Tctf_attribute of Ocaml_typing.Typedtree.attribute
and class_declaration =
Ocaml_typing.Typedtree.class_expr Ocaml_typing.Typedtree.class_infosand class_description =
Ocaml_typing.Typedtree.class_type Ocaml_typing.Typedtree.class_infosand class_type_declaration =
Ocaml_typing.Typedtree.class_type Ocaml_typing.Typedtree.class_infosand 'a class_infos = {ci_virt : Ocaml_parsing.Asttypes.virtual_flag;ci_params : (Ocaml_typing.Typedtree.core_type * (Ocaml_parsing.Asttypes.variance * Ocaml_parsing.Asttypes.injectivity)) list;ci_id_name : string Ocaml_parsing.Asttypes.loc;ci_id_class : Ocaml_typing.Ident.t;ci_id_class_type : Ocaml_typing.Ident.t;ci_id_object : Ocaml_typing.Ident.t;ci_expr : 'a;ci_decl : Ocaml_typing.Types.class_declaration;ci_type_decl : Ocaml_typing.Types.class_type_declaration;ci_loc : Ocaml_parsing.Location.t;ci_attributes : Ocaml_typing.Typedtree.attributes;
}type implementation = {structure : Ocaml_typing.Typedtree.structure;coercion : Ocaml_typing.Typedtree.module_coercion;signature : Ocaml_typing.Types.signature;shape : Ocaml_typing.Shape.t;
}A typechecked implementation including its module structure, its exported signature, and a coercion of the module against that signature.
If an .mli file is present, the signature will come from that file and be the exported signature of the module.
If there isn't one, the signature will be inferred from the module structure.
type item_declaration = | Value of Ocaml_typing.Typedtree.value_description| Value_binding of Ocaml_typing.Typedtree.value_binding| Type of Ocaml_typing.Typedtree.type_declaration| Constructor of Ocaml_typing.Typedtree.constructor_declaration| Extension_constructor of Ocaml_typing.Typedtree.extension_constructor| Label of Ocaml_typing.Typedtree.label_declaration| Module of Ocaml_typing.Typedtree.module_declaration| Module_substitution of Ocaml_typing.Typedtree.module_substitution| Module_binding of Ocaml_typing.Typedtree.module_binding| Module_type of Ocaml_typing.Typedtree.module_type_declaration| Class of Ocaml_typing.Typedtree.class_declaration| Class_type of Ocaml_typing.Typedtree.class_type_declaration(*
*)item_declarationgroups together items that correspond to the syntactic category of "declarations" which include types, values, modules, etc. declarations in signatures and their definitions in implementations.
val as_computation_pattern :
Ocaml_typing.Typedtree.pattern ->
Ocaml_typing.Typedtree.computation Ocaml_typing.Typedtree.general_patternas_computation_pattern p is a computation pattern with description Tpat_value p, which enforces a correct placement of pat_attributes and pat_extra metadata (on the inner value pattern, rather than on the computation pattern).
val classify_pattern_desc :
'k Ocaml_typing.Typedtree.pattern_desc ->
'k Ocaml_typing.Typedtree.pattern_categoryval classify_pattern :
'k Ocaml_typing.Typedtree.general_pattern ->
'k Ocaml_typing.Typedtree.pattern_categoryval shallow_iter_pattern_desc :
Ocaml_typing.Typedtree.pattern_action ->
'k Ocaml_typing.Typedtree.pattern_desc ->
unittype pattern_transformation = {f : 'k. 'k Ocaml_typing.Typedtree.general_pattern -> 'k Ocaml_typing.Typedtree.general_pattern;
}val shallow_map_pattern_desc :
Ocaml_typing.Typedtree.pattern_transformation ->
'k Ocaml_typing.Typedtree.pattern_desc ->
'k Ocaml_typing.Typedtree.pattern_descval iter_general_pattern :
Ocaml_typing.Typedtree.pattern_action ->
'k Ocaml_typing.Typedtree.general_pattern ->
unitval iter_pattern :
(Ocaml_typing.Typedtree.pattern -> unit) ->
Ocaml_typing.Typedtree.pattern ->
unitval exists_general_pattern :
Ocaml_typing.Typedtree.pattern_predicate ->
'k Ocaml_typing.Typedtree.general_pattern ->
boolval exists_pattern :
(Ocaml_typing.Typedtree.pattern -> bool) ->
Ocaml_typing.Typedtree.pattern ->
boolval let_bound_idents :
Ocaml_typing.Typedtree.value_binding list ->
Ocaml_typing.Ident.t listval let_bound_idents_full :
Ocaml_typing.Typedtree.value_binding list ->
(Ocaml_typing.Ident.t
* string Ocaml_parsing.Asttypes.loc
* Ocaml_typing.Types.type_expr
* Ocaml_typing.Types.Uid.t)
listval alpha_pat :
(Ocaml_typing.Ident.t * Ocaml_typing.Ident.t) list ->
'k Ocaml_typing.Typedtree.general_pattern ->
'k Ocaml_typing.Typedtree.general_patternAlpha conversion of patterns
val mknoloc : 'a -> 'a Ocaml_parsing.Asttypes.locval mkloc : 'a -> Ocaml_parsing.Location.t -> 'a Ocaml_parsing.Asttypes.locval pat_bound_idents :
'k Ocaml_typing.Typedtree.general_pattern ->
Ocaml_typing.Ident.t listval pat_bound_idents_full :
'k Ocaml_typing.Typedtree.general_pattern ->
(Ocaml_typing.Ident.t
* string Ocaml_parsing.Asttypes.loc
* Ocaml_typing.Types.type_expr
* Ocaml_typing.Types.Uid.t)
listval split_pattern :
Ocaml_typing.Typedtree.computation Ocaml_typing.Typedtree.general_pattern ->
Ocaml_typing.Typedtree.pattern option * Ocaml_typing.Typedtree.pattern optionSplits an or pattern into its value (left) and exception (right) parts.
val map_apply_arg :
('a -> 'b) ->
('a, 'omitted) Ocaml_typing.Typedtree.arg_or_omitted ->
('b, 'omitted) Ocaml_typing.Typedtree.arg_or_omittedval exp_is_nominal : Ocaml_typing.Typedtree.expression -> boolWhether an expression looks nice as the subject of a sentence in a error message.
val unpack_functor_me :
Ocaml_typing.Typedtree.module_expr ->
Ocaml_typing.Typedtree.functor_parameter * Ocaml_typing.Typedtree.module_exprval unpack_functor_mty :
Ocaml_typing.Typedtree.module_type ->
Ocaml_typing.Typedtree.functor_parameter * Ocaml_typing.Typedtree.module_type