Module Typecore

type type_forcing_context =
  1. | If_conditional
  2. | If_no_else_branch
  3. | While_loop_conditional
  4. | While_loop_body
  5. | For_loop_start_index
  6. | For_loop_stop_index
  7. | For_loop_body
  8. | Assert_condition
  9. | Sequence_left_hand_side
  10. | When_guard
type type_expected = private {
  1. ty : Types.type_expr;
  2. explanation : type_forcing_context option;
}
type pattern_variable = {
  1. pv_id : Ident.t;
  2. pv_type : Types.type_expr;
  3. pv_loc : Location.t;
  4. pv_as_var : bool;
  5. pv_attributes : Typedtree.attributes;
}
val mk_expected : ?explanation:type_forcing_context -> Types.type_expr -> type_expected
val is_nonexpansive : Typedtree.expression -> bool
module Datatype_kind : sig ... end
type wrong_name = {
  1. type_path : Path.t;
  2. kind : Datatype_kind.t;
  3. name : string Asttypes.loc;
  4. valid_names : string list;
}
type wrong_kind_context =
  1. | Pattern
  2. | Expression of type_forcing_context option
type wrong_kind_sort =
  1. | Constructor
  2. | Record
  3. | Boolean
  4. | List
  5. | Unit
type existential_restriction =
  1. | At_toplevel
    (*

    no existential types at the toplevel

    *)
  2. | In_group
    (*

    nor with let ... and ...

    *)
  3. | In_rec
    (*

    or recursive definition

    *)
  4. | With_attributes
    (*

    or let[@any_attribute] = ...

    *)
  5. | In_class_args
    (*

    or in class arguments class c (...) = ...

    *)
  6. | In_class_def
    (*

    or in class c = let ... in ...

    *)
  7. | In_self_pattern
    (*

    or in self pattern

    *)
type module_patterns_restriction =
  1. | Modules_allowed of {
    1. scope : int;
    }
  2. | Modules_rejected
val type_expression : Env.t -> Parsetree.expression -> Typedtree.expression
val type_class_arg_pattern : string -> Env.t -> Env.t -> Asttypes.arg_label -> Parsetree.pattern -> Typedtree.pattern * (Ident.t * Ident.t * Types.type_expr) list * Env.t * Env.t
val type_self_pattern : Env.t -> Parsetree.pattern -> Typedtree.pattern * pattern_variable list
val extract_option_type : Env.t -> Types.type_expr -> Types.type_expr
val generalizable : int -> Types.type_expr -> bool
val generalize_structure_exp : Typedtree.expression -> unit
val reset_delayed_checks : unit -> unit
val force_delayed_checks : unit -> unit
val name_pattern : string -> Typedtree.pattern list -> Ident.t
val name_cases : string -> Typedtree.value Typedtree.case list -> Ident.t
val self_coercion : (Path.t * Location.t list ref) list ref
type error =
  1. | Constructor_arity_mismatch of Longident.t * int * int
  2. | Label_mismatch of Longident.t * Errortrace.unification_error
  3. | Pattern_type_clash : Errortrace.unification_error * Parsetree.pattern_desc option -> error
  4. | Or_pattern_type_clash of Ident.t * Errortrace.unification_error
  5. | Multiply_bound_variable of string
  6. | Orpat_vars of Ident.t * Ident.t list
  7. | Expr_type_clash of Errortrace.unification_error * type_forcing_context option * Parsetree.expression_desc option
  8. | Apply_non_function of {
    1. funct : Typedtree.expression;
    2. func_ty : Types.type_expr;
    3. res_ty : Types.type_expr;
    4. previous_arg_loc : Location.t;
    5. extra_arg_loc : Location.t;
    }
  9. | Apply_wrong_label of Asttypes.arg_label * Types.type_expr * bool
  10. | Label_multiply_defined of string
  11. | Label_missing of Ident.t list
  12. | Label_not_mutable of Longident.t
  13. | Wrong_name of string * type_expected * wrong_name
  14. | Name_type_mismatch of Datatype_kind.t * Longident.t * Path.t * Path.t * (Path.t * Path.t) list
  15. | Invalid_format of string
  16. | Not_an_object of Types.type_expr * type_forcing_context option
  17. | Undefined_method of Types.type_expr * string * string list option
  18. | Undefined_self_method of string * string list
  19. | Virtual_class of Longident.t
  20. | Private_type of Types.type_expr
  21. | Private_label of Longident.t * Types.type_expr
  22. | Private_constructor of Types.constructor_description * Types.type_expr
  23. | Unbound_instance_variable of string * string list
  24. | Instance_variable_not_mutable of string
  25. | Not_subtype of Errortrace.Subtype.error
  26. | Outside_class
  27. | Value_multiply_overridden of string
  28. | Coercion_failure of Errortrace.expanded_type * Errortrace.unification_error * bool
  29. | Not_a_function of Types.type_expr * type_forcing_context option
  30. | Too_many_arguments of Types.type_expr * type_forcing_context option
  31. | Abstract_wrong_label of {
    1. got : Asttypes.arg_label;
    2. expected : Asttypes.arg_label;
    3. expected_type : Types.type_expr;
    4. explanation : type_forcing_context option;
    }
  32. | Scoping_let_module of string * Types.type_expr
  33. | Not_a_polymorphic_variant_type of Longident.t
  34. | Incoherent_label_order
  35. | Less_general of string * Errortrace.unification_error
  36. | Modules_not_allowed
  37. | Cannot_infer_signature
  38. | Not_a_packed_module of Types.type_expr
  39. | Unexpected_existential of existential_restriction * string * string list
  40. | Invalid_interval
  41. | Invalid_for_loop_index
  42. | No_value_clauses
  43. | Exception_pattern_disallowed
  44. | Mixed_value_and_exception_patterns_under_guard
  45. | Inlined_record_escape
  46. | Inlined_record_expected
  47. | Unrefuted_pattern of Typedtree.pattern
  48. | Invalid_extension_constructor_payload
  49. | Not_an_extension_constructor
  50. | Literal_overflow of string
  51. | Unknown_literal of string * char
  52. | Illegal_letrec_pat
  53. | Illegal_letrec_expr
  54. | Illegal_class_expr
  55. | Letop_type_clash of string * Errortrace.unification_error
  56. | Andop_type_clash of string * Errortrace.unification_error
  57. | Bindings_type_clash of Errortrace.unification_error
  58. | Unbound_existential of Ident.t list * Types.type_expr
  59. | Missing_type_constraint
  60. | Wrong_expected_kind of wrong_kind_sort * wrong_kind_context * Types.type_expr
  61. | Expr_not_a_record_type of Types.type_expr
exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
val report_error : loc:Location.t -> Env.t -> error -> Location.error
val type_open : (?used_slot:bool ref -> Asttypes.override_flag -> Env.t -> Location.t -> Longident.t Asttypes.loc -> Path.t * Env.t) ref
val type_open_decl : (?used_slot:bool ref -> Env.t -> Parsetree.open_declaration -> Typedtree.open_declaration * Types.signature * Env.t) ref
val type_object : (Env.t -> Location.t -> Parsetree.class_structure -> Typedtree.class_structure * string list) ref
val check_recursive_bindings : Env.t -> Typedtree.value_binding list -> unit
val check_recursive_class_bindings : Env.t -> Ident.t list -> Typedtree.class_expr list -> unit