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_kind =
  1. | Std_var
  2. | As_var
  3. | Continuation_var
type pattern_variable = {
  1. pv_id : Ident.t;
  2. pv_type : Types.type_expr;
  3. pv_loc : Location.t;
  4. pv_kind : pattern_variable_kind;
  5. pv_attributes : Typedtree.attributes;
  6. pv_uid : Types.Uid.t;
}
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

    *)
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 check_partial : ?lev:int -> Env.t -> Types.type_expr -> Location.t -> Typedtree.value Typedtree.case list -> Typedtree.partial
val extract_option_type : Env.t -> Types.type_expr -> Types.type_expr
val generalizable : int -> Types.type_expr -> bool
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 existential_binding =
  1. | Bind_already_bound
  2. | Bind_not_in_scope
  3. | Bind_non_locally_abstract
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 option
  8. | Function_arity_type_clash of {
    1. syntactic_arity : int;
    2. type_constraint : Types.type_expr;
    3. trace : Errortrace.unification_error;
    }
  9. | 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;
    }
  10. | Apply_wrong_label of Asttypes.arg_label * Types.type_expr * bool
  11. | Label_multiply_defined of string
  12. | Label_missing of Ident.t list
  13. | Label_not_mutable of Longident.t
  14. | Wrong_name of string * type_expected * wrong_name
  15. | Name_type_mismatch of Datatype_kind.t * Longident.t * Path.t * Path.t * (Path.t * Path.t) list
  16. | Invalid_format of string
  17. | Not_an_object of Types.type_expr * type_forcing_context option
  18. | Undefined_method of Types.type_expr * string * string list option
  19. | Undefined_self_method of string * string list
  20. | Virtual_class of Longident.t
  21. | Private_type of Types.type_expr
  22. | Private_label of Longident.t * Types.type_expr
  23. | Private_constructor of Types.constructor_description * Types.type_expr
  24. | Unbound_instance_variable of string * string list
  25. | Instance_variable_not_mutable of string
  26. | Not_subtype of Errortrace.Subtype.error
  27. | Outside_class
  28. | Value_multiply_overridden of string
  29. | Coercion_failure of Errortrace.expanded_type * Errortrace.unification_error * bool
  30. | Not_a_function of Types.type_expr * type_forcing_context option
  31. | Too_many_arguments of Types.type_expr * type_forcing_context option
  32. | 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;
    }
  33. | Scoping_let_module of string * Types.type_expr
  34. | Not_a_polymorphic_variant_type of Longident.t
  35. | Incoherent_label_order
  36. | Less_general of string * Errortrace.unification_error
  37. | Modules_not_allowed
  38. | Cannot_infer_signature
  39. | Not_a_packed_module of Types.type_expr
  40. | Unexpected_existential of existential_restriction * string
  41. | Invalid_interval
  42. | Invalid_for_loop_index
  43. | No_value_clauses
  44. | Exception_pattern_disallowed
  45. | Mixed_value_and_exception_patterns_under_guard
  46. | Effect_pattern_below_toplevel
  47. | Invalid_continuation_pattern
  48. | Inlined_record_escape
  49. | Inlined_record_expected
  50. | Unrefuted_pattern of Typedtree.pattern
  51. | Invalid_extension_constructor_payload
  52. | Not_an_extension_constructor
  53. | Literal_overflow of string
  54. | Unknown_literal of string * char
  55. | Illegal_letrec_pat
  56. | Illegal_letrec_expr
  57. | Illegal_class_expr
  58. | Letop_type_clash of string * Errortrace.unification_error
  59. | Andop_type_clash of string * Errortrace.unification_error
  60. | Bindings_type_clash of Errortrace.unification_error
  61. | Unbound_existential of Ident.t list * Types.type_expr
  62. | Bind_existential of existential_binding * Ident.t * Types.type_expr
  63. | Missing_type_constraint
  64. | Wrong_expected_kind of wrong_kind_sort * wrong_kind_context * Types.type_expr
  65. | 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 annotate_recursive_bindings : Env.t -> Typedtree.value_binding list -> Typedtree.value_binding list
val check_recursive_class_bindings : Env.t -> Ident.t list -> Typedtree.class_expr list -> unit