jon.recoil.org

Module Ocaml_typing.Typedtree

Abstract syntax tree after typing

By comparison with Parsetree:

type partial =
  1. | Partial
  2. | Total

Extension points

type attributes = Ocaml_typing.Typedtree.attribute list

Core language

type value =
  1. | Value_pattern
type computation =
  1. | Computation_pattern
and pat_extra =
  1. | Tpat_constraint of Ocaml_typing.Typedtree.core_type
    (*

    P : T pat_desc = P ; pat_extra = (Tpat_constraint T, _, _) :: ...

    *)
  2. | 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 disjunction is a Tpat_or _ representing the branches of tconst.

    *)
  3. | Tpat_open of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Env.t
  4. | 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 =
  1. | Tpat_any : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc
    (*

    _

    *)
  2. | Tpat_var : Ocaml_typing.Ident.t * string Ocaml_parsing.Asttypes.loc * Uid.t -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc
    (*

    x

    *)
  3. | 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

    *)
  4. | Tpat_constant : Ocaml_parsing.Asttypes.constant -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc
    (*

    1, 'a', "true", 1.0, 1l, 1L, 1n

    *)
  5. | 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

    *)
  6. | 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))

    *)
  7. | 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
    (*

    `A (None) `A P (Some P)

    See Types.row_desc for an explanation of the last parameter.

    *)
  8. | 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

    *)
  9. | 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 |

    *)
  10. | Tpat_lazy : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern -> Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.pattern_desc
    (*

    lazy P

    *)
  11. | 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 the as_computation_pattern function below instead of using the Tpat_value constructor directly.

    *)
  12. | Tpat_exception : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.general_pattern -> Ocaml_typing.Typedtree.computation Ocaml_typing.Typedtree.pattern_desc
    (*

    exception P

    *)
  13. | 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 translating Ppat_type _, None otherwise.

    *)
and exp_extra =
  1. | Texp_constraint of Ocaml_typing.Typedtree.core_type
    (*

    E : T

    *)
  2. | Texp_coerce of Ocaml_typing.Typedtree.core_type option * Ocaml_typing.Typedtree.core_type
    (*

    E :> T Texp_coerce (None, T) E : T0 :> T Texp_coerce (Some T0, T)

    *)
  3. | Texp_poly of Ocaml_typing.Typedtree.core_type option
    (*

    Used for method bodies.

    *)
  4. | Texp_newtype of string
    (*

    fun (type t) ->

    *)
  5. | 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 uses Texp_newtype. Those can appear when unmarshaling cmt files. By adding a new constructor, we can still safely uses these.

    *)
and expression_desc =
  1. | Texp_ident of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Types.value_description
    (*

    x M.x

    *)
  2. | Texp_constant of Ocaml_parsing.Asttypes.constant
    (*

    1, 'a', "true", 1.0, 1l, 1L, 1n

    *)
  3. | 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)

    *)
  4. | 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.

    *)
  5. | 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)) )

    *)
  6. | 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)], _)

    *)
  7. | 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)])

    *)
  8. | Texp_tuple of (string option * Ocaml_typing.Typedtree.expression) list
    (*

    Texp_tuple(el) represents

    • (E1, ..., En) when el is (None, E1);...;(None, En),
    • (L1:E1, ..., Ln:En) when el is (Some L1, E1);...;(Some Ln, En),
    • Any mix, e.g. (L1: E1, E2) when el is (Some L1, E1); (None, E2)
    *)
  9. | 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 E C (E1, ..., En) E1;...;En

    *)
  10. | Texp_variant of Ocaml_parsing.Asttypes.label * Ocaml_typing.Typedtree.expression option
  11. | Texp_record of {
    1. fields : (Ocaml_typing.Data_types.label_description * Ocaml_typing.Typedtree.record_label_definition) array;
    2. representation : Ocaml_typing.Types.record_representation;
    3. 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 expression E0 with t2=P2 is represented as Texp_record fields = [| l1, Kept t1; l2 Override P2 |]; representation; extended_expression = Some E0

    *)
  12. | Texp_atomic_loc of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.label_description
  13. | Texp_field of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Data_types.label_description
  14. | 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
  15. | Texp_array of Ocaml_parsing.Asttypes.mutable_flag * Ocaml_typing.Typedtree.expression list
  16. | Texp_ifthenelse of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression option
  17. | Texp_sequence of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression
  18. | Texp_while of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.expression
  19. | 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
  20. | Texp_send of Ocaml_typing.Typedtree.expression * Ocaml_typing.Typedtree.meth
  21. | Texp_new of Ocaml_typing.Path.t * Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Types.class_declaration
  22. | Texp_instvar of Ocaml_typing.Path.t * Ocaml_typing.Path.t * string Ocaml_parsing.Asttypes.loc
  23. | Texp_setinstvar of Ocaml_typing.Path.t * Ocaml_typing.Path.t * string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.expression
  24. | Texp_override of Ocaml_typing.Path.t * (Ocaml_typing.Ident.t * string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.expression) list
  25. | 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
  26. | Texp_letexception of Ocaml_typing.Typedtree.extension_constructor * Ocaml_typing.Typedtree.expression
  27. | Texp_assert of Ocaml_typing.Typedtree.expression * Ocaml_parsing.Location.t
  28. | Texp_lazy of Ocaml_typing.Typedtree.expression
  29. | Texp_object of Ocaml_typing.Typedtree.class_structure * string list
  30. | Texp_pack of Ocaml_typing.Typedtree.module_expr
  31. | Texp_letop of {
    1. let_ : Ocaml_typing.Typedtree.binding_op;
    2. ands : Ocaml_typing.Typedtree.binding_op list;
    3. param : Ocaml_typing.Ident.t;
    4. body : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case;
    5. partial : Ocaml_typing.Typedtree.partial;
    }
  32. | Texp_unreachable
  33. | Texp_extension_constructor of Ocaml_parsing.Longident.t Ocaml_parsing.Asttypes.loc * Ocaml_typing.Path.t
  34. | Texp_open of Ocaml_typing.Typedtree.open_declaration * Ocaml_typing.Typedtree.expression
    (*

    let open! M in e

    *)
  35. | Texp_typed_hole
and meth =
  1. | Tmeth_name of string
  2. | Tmeth_val of Ocaml_typing.Ident.t
  3. | Tmeth_ancestor of Ocaml_typing.Ident.t * Ocaml_typing.Path.t
and function_param = {
  1. fp_arg_label : Ocaml_parsing.Asttypes.arg_label;
  2. fp_param : Ocaml_typing.Ident.t;
    (*

    fp_param is the identifier that is to be used to name the parameter of the function.

    *)
  3. fp_partial : Ocaml_typing.Typedtree.partial;
    (*

    fp_partial = Partial if the pattern match is partial Total otherwise.

    *)
  4. fp_kind : Ocaml_typing.Typedtree.function_param_kind;
  5. fp_newtypes : string Ocaml_parsing.Asttypes.loc list;
    (*

    fp_newtypes are 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 in Untypeast.

    *)
  6. fp_loc : Ocaml_parsing.Location.t;
    (*

    fp_loc is the location of the entire value parameter, not including the fp_newtypes.

    *)
}
and function_param_kind =
  1. | Tparam_pat of Ocaml_typing.Typedtree.pattern
    (*

    Tparam_pat p is a non-optional argument with pattern p.

    *)
  2. | Tparam_optional_default of Ocaml_typing.Typedtree.pattern * Ocaml_typing.Typedtree.expression
    (*

    Tparam_optional_default (p, e) is an optional argument p with default value e, i.e. ?x:(p = e). If the parameter is of type a option, the pattern and expression are of type a.

    *)
and function_body =
  1. | Tfunction_body of Ocaml_typing.Typedtree.expression
  2. | Tfunction_cases of {
    1. cases : Ocaml_typing.Typedtree.value Ocaml_typing.Typedtree.case list;
    2. partial : Ocaml_typing.Typedtree.partial;
    3. param : Ocaml_typing.Ident.t;
    4. loc : Ocaml_parsing.Location.t;
    5. exp_extra : Ocaml_typing.Typedtree.exp_extra option;
    6. attributes : Ocaml_typing.Typedtree.attributes;
      (*

      attributes is just used in untypeast.

      *)
    }
    (*

    The function body binds a final argument in Tfunction_cases, and this argument is pattern-matched against the cases.

    *)
and ('a, 'b) arg_or_omitted =
  1. | Arg of 'a
  2. | Omitted of 'b
and module_type_constraint =
  1. | Tmodtype_implicit
    (*

    The module type constraint has been synthesized during typechecking.

    *)
  2. | Tmodtype_explicit of Ocaml_typing.Typedtree.module_type
    (*

    The module type was in the source file.

    *)

Annotations for Tmod_constraint.

and functor_parameter =
  1. | Unit
  2. | Named of Ocaml_typing.Ident.t option * string option Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.module_type
and structure = {
  1. str_items : Ocaml_typing.Typedtree.structure_item list;
  2. str_type : Ocaml_typing.Types.signature;
  3. str_final_env : Ocaml_typing.Env.t;
}
and structure_item = {
  1. str_desc : Ocaml_typing.Typedtree.structure_item_desc;
  2. str_loc : Ocaml_parsing.Location.t;
  3. str_env : Ocaml_typing.Env.t;
}
and module_binding = {
  1. mb_id : Ocaml_typing.Ident.t option;
    (*

    None for module _ = struct ... end

    *)
  2. mb_name : string option Ocaml_parsing.Asttypes.loc;
  3. mb_uid : Uid.t;
  4. mb_presence : Ocaml_typing.Types.module_presence;
  5. mb_expr : Ocaml_typing.Typedtree.module_expr;
  6. mb_attributes : Ocaml_typing.Typedtree.attributes;
  7. mb_loc : Ocaml_parsing.Location.t;
}
and module_coercion =
  1. | Tcoerce_none
  2. | Tcoerce_structure of (int * Ocaml_typing.Typedtree.module_coercion) list * (Ocaml_typing.Ident.t * int * Ocaml_typing.Typedtree.module_coercion) list
  3. | Tcoerce_functor of Ocaml_typing.Typedtree.module_coercion * Ocaml_typing.Typedtree.module_coercion
  4. | 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" end

    Only occurs inside a Tcoerce_structure coercion.

    *)
  5. | 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 end

    Only occurs inside a Tcoerce_structure coercion.

    *)
and signature = {
  1. sig_items : Ocaml_typing.Typedtree.signature_item list;
  2. sig_type : Ocaml_typing.Types.signature;
  3. sig_final_env : Ocaml_typing.Env.t;
}
and signature_item = {
  1. sig_desc : Ocaml_typing.Typedtree.signature_item_desc;
  2. sig_env : Ocaml_typing.Env.t;
  3. sig_loc : Ocaml_parsing.Location.t;
}
and module_declaration = {
  1. md_id : Ocaml_typing.Ident.t option;
  2. md_name : string option Ocaml_parsing.Asttypes.loc;
  3. md_uid : Uid.t;
  4. md_presence : Ocaml_typing.Types.module_presence;
  5. md_type : Ocaml_typing.Typedtree.module_type;
  6. md_attributes : Ocaml_typing.Typedtree.attributes;
  7. md_loc : Ocaml_parsing.Location.t;
}
and module_type_declaration = {
  1. mtd_id : Ocaml_typing.Ident.t;
  2. mtd_name : string Ocaml_parsing.Asttypes.loc;
  3. mtd_uid : Uid.t;
  4. mtd_type : Ocaml_typing.Typedtree.module_type option;
  5. mtd_attributes : Ocaml_typing.Typedtree.attributes;
  6. mtd_loc : Ocaml_parsing.Location.t;
}
and 'a open_infos = {
  1. open_expr : 'a;
  2. open_bound_items : Ocaml_typing.Types.signature;
  3. open_override : Ocaml_parsing.Asttypes.override_flag;
  4. open_env : Ocaml_typing.Env.t;
  5. open_loc : Ocaml_parsing.Location.t;
  6. open_attributes : Ocaml_typing.Typedtree.attribute list;
}
and 'a include_infos = {
  1. incl_mod : 'a;
  2. incl_type : Ocaml_typing.Types.signature;
  3. incl_loc : Ocaml_parsing.Location.t;
  4. incl_attributes : Ocaml_typing.Typedtree.attribute list;
}
and core_type = {
  1. mutable ctyp_desc : Ocaml_typing.Typedtree.core_type_desc;
    (*

    mutable because of Typeclass.declare_method

    *)
  2. mutable ctyp_type : Ocaml_typing.Types.type_expr;
    (*

    mutable because of Typeclass.declare_method

    *)
  3. ctyp_env : Ocaml_typing.Env.t;
  4. ctyp_loc : Ocaml_parsing.Location.t;
  5. ctyp_attributes : Ocaml_typing.Typedtree.attributes;
}
and row_field_desc =
  1. | Ttag of string Ocaml_parsing.Asttypes.loc * bool * Ocaml_typing.Typedtree.core_type list
  2. | Tinherit of Ocaml_typing.Typedtree.core_type
and object_field_desc =
  1. | OTtag of string Ocaml_parsing.Asttypes.loc * Ocaml_typing.Typedtree.core_type
  2. | OTinherit of Ocaml_typing.Typedtree.core_type
and value_description = {
  1. val_id : Ocaml_typing.Ident.t;
  2. val_name : string Ocaml_parsing.Asttypes.loc;
  3. val_desc : Ocaml_typing.Typedtree.core_type;
  4. val_val : Ocaml_typing.Types.value_description;
  5. val_prim : string list;
  6. val_loc : Ocaml_parsing.Location.t;
  7. val_attributes : Ocaml_typing.Typedtree.attributes;
}
and type_kind =
  1. | Ttype_abstract
  2. | Ttype_variant of Ocaml_typing.Typedtree.constructor_declaration list
  3. | Ttype_record of Ocaml_typing.Typedtree.label_declaration list
  4. | Ttype_open
and constructor_declaration = {
  1. cd_id : Ocaml_typing.Ident.t;
  2. cd_name : string Ocaml_parsing.Asttypes.loc;
  3. cd_uid : Uid.t;
  4. cd_vars : string Ocaml_parsing.Asttypes.loc list;
  5. cd_args : Ocaml_typing.Typedtree.constructor_arguments;
  6. cd_res : Ocaml_typing.Typedtree.core_type option;
  7. cd_loc : Ocaml_parsing.Location.t;
  8. cd_attributes : Ocaml_typing.Typedtree.attributes;
}
and constructor_arguments =
  1. | Cstr_tuple of Ocaml_typing.Typedtree.core_type list
  2. | Cstr_record of Ocaml_typing.Typedtree.label_declaration list
and type_exception = {
  1. tyexn_constructor : Ocaml_typing.Typedtree.extension_constructor;
  2. tyexn_loc : Ocaml_parsing.Location.t;
  3. tyexn_attributes : Ocaml_typing.Typedtree.attribute list;
}
and class_signature = {
  1. csig_self : Ocaml_typing.Typedtree.core_type;
  2. csig_fields : Ocaml_typing.Typedtree.class_type_field list;
  3. csig_type : Ocaml_typing.Types.class_signature;
}

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 =
  1. | Value of Ocaml_typing.Typedtree.value_description
  2. | Value_binding of Ocaml_typing.Typedtree.value_binding
  3. | Type of Ocaml_typing.Typedtree.type_declaration
  4. | Constructor of Ocaml_typing.Typedtree.constructor_declaration
  5. | Extension_constructor of Ocaml_typing.Typedtree.extension_constructor
  6. | Label of Ocaml_typing.Typedtree.label_declaration
  7. | Module of Ocaml_typing.Typedtree.module_declaration
  8. | Module_substitution of Ocaml_typing.Typedtree.module_substitution
  9. | Module_binding of Ocaml_typing.Typedtree.module_binding
  10. | Module_type of Ocaml_typing.Typedtree.module_type_declaration
  11. | Class of Ocaml_typing.Typedtree.class_declaration
  12. | Class_type of Ocaml_typing.Typedtree.class_type_declaration
    (*

    item_declaration groups together items that correspond to the syntactic category of "declarations" which include types, values, modules, etc. declarations in signatures and their definitions in implementations.

    *)

as_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).

type pattern_action = {
  1. f : 'k. 'k Ocaml_typing.Typedtree.general_pattern -> unit;
}
type pattern_transformation = {
  1. f : 'k. 'k Ocaml_typing.Typedtree.general_pattern -> 'k Ocaml_typing.Typedtree.general_pattern;
}
val iter_pattern : (Ocaml_typing.Typedtree.pattern -> unit) -> Ocaml_typing.Typedtree.pattern -> unit
type pattern_predicate = {
  1. f : 'k. 'k Ocaml_typing.Typedtree.general_pattern -> bool;
}
val exists_pattern : (Ocaml_typing.Typedtree.pattern -> bool) -> Ocaml_typing.Typedtree.pattern -> bool
val mknoloc : 'a -> 'a Ocaml_parsing.Asttypes.loc

Splits 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_omitted
val exp_is_nominal : Ocaml_typing.Typedtree.expression -> bool

Whether an expression looks nice as the subject of a sentence in a error message.