package ocaml-base-compiler

  1. Overview
  2. Docs
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
type type_expected = private {
  1. ty : Types.type_expr;
  2. explanation : type_forcing_context option;
}
val mk_expected : ?explanation:type_forcing_context -> Types.type_expr -> type_expected
val is_nonexpansive : Typedtree.expression -> bool
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 * string Asttypes.loc * Ident.t * Types.type_expr) list * Env.t * Env.t
val check_partial : ?lev:int -> Env.t -> Types.type_expr -> Location.t -> Typedtree.case list -> Typedtree.partial
val extract_option_type : Env.t -> Types.type_expr -> Types.type_expr
val iter_pattern : (Typedtree.pattern -> unit) -> Typedtree.pattern -> unit
val generalizable : int -> Types.type_expr -> bool
val reset_delayed_checks : unit -> unit
val force_delayed_checks : unit -> unit
val name_pattern : string -> Typedtree.case list -> Ident.t
val self_coercion : (Path.t * Location.t list ref) list ref
type error =
  1. | Polymorphic_label of Longident.t
  2. | Constructor_arity_mismatch of Longident.t * int * int
  3. | Label_mismatch of Longident.t * (Types.type_expr * Types.type_expr) list
  4. | Pattern_type_clash of (Types.type_expr * Types.type_expr) list
  5. | Or_pattern_type_clash of Ident.t * (Types.type_expr * Types.type_expr) list
  6. | Multiply_bound_variable of string
  7. | Orpat_vars of Ident.t * Ident.t list
  8. | Expr_type_clash of (Types.type_expr * Types.type_expr) list * type_forcing_context option
  9. | Apply_non_function of Types.type_expr
  10. | Apply_wrong_label of Asttypes.arg_label * Types.type_expr
  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 * string * Path.t * string * string list
  15. | Name_type_mismatch of string * Longident.t * Path.t * Path.t * (Path.t * Path.t) list
  16. | Invalid_format of string
  17. | Undefined_method of Types.type_expr * string * string list option
  18. | Undefined_inherited_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. | Unbound_instance_variable of string * string list
  23. | Instance_variable_not_mutable of bool * string
  24. | Not_subtype of (Types.type_expr * Types.type_expr) list * (Types.type_expr * Types.type_expr) list
  25. | Outside_class
  26. | Value_multiply_overridden of string
  27. | Coercion_failure of Types.type_expr * Types.type_expr * (Types.type_expr * Types.type_expr) list * bool
  28. | Too_many_arguments of bool * Types.type_expr * type_forcing_context option
  29. | Abstract_wrong_label of Asttypes.arg_label * Types.type_expr * type_forcing_context option
  30. | Scoping_let_module of string * Types.type_expr
  31. | Masked_instance_variable of Longident.t
  32. | Not_a_variant_type of Longident.t
  33. | Incoherent_label_order
  34. | Less_general of string * (Types.type_expr * Types.type_expr) list
  35. | Modules_not_allowed
  36. | Cannot_infer_signature
  37. | Not_a_packed_module of Types.type_expr
  38. | Recursive_local_constraint of (Types.type_expr * Types.type_expr) list
  39. | Unexpected_existential
  40. | Invalid_interval
  41. | Invalid_for_loop_index
  42. | No_value_clauses
  43. | Exception_pattern_below_toplevel
  44. | Inlined_record_escape
  45. | Inlined_record_expected
  46. | Unrefuted_pattern of Typedtree.pattern
  47. | Invalid_extension_constructor_payload
  48. | Not_an_extension_constructor
  49. | Literal_overflow of string
  50. | Unknown_literal of string * char
  51. | Illegal_letrec_pat
  52. | Illegal_letrec_expr
  53. | Illegal_class_expr
  54. | Empty_pattern
exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
val report_error : Env.t -> Format.formatter -> error -> unit
val type_open : (?used_slot:bool ref -> Asttypes.override_flag -> Env.t -> Location.t -> Longident.t Asttypes.loc -> Path.t * Env.t) 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