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
  10. | When_guard
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
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 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 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 error =
  1. | Constructor_arity_mismatch of Longident.t * int * int
  2. | Label_mismatch of Longident.t * Ctype.Unification_trace.t
  3. | Pattern_type_clash : Ctype.Unification_trace.t * _ Typedtree.pattern_desc option -> error
  4. | Or_pattern_type_clash of Ident.t * Ctype.Unification_trace.t
  5. | Multiply_bound_variable of string
  6. | Orpat_vars of Ident.t * Ident.t list
  7. | Expr_type_clash of Ctype.Unification_trace.t * type_forcing_context option * Typedtree.expression_desc option
  8. | Apply_non_function of Types.type_expr
  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. | Undefined_method of Types.type_expr * string * string list option
  17. | Undefined_inherited_method of string * string list
  18. | Virtual_class of Longident.t
  19. | Private_type of Types.type_expr
  20. | Private_label of Longident.t * Types.type_expr
  21. | Private_constructor of Types.constructor_description * Types.type_expr
  22. | Unbound_instance_variable of string * string list
  23. | Instance_variable_not_mutable of string
  24. | Not_subtype of Ctype.Unification_trace.t * Ctype.Unification_trace.t
  25. | Outside_class
  26. | Value_multiply_overridden of string
  27. | Coercion_failure of Types.type_expr * Types.type_expr * Ctype.Unification_trace.t * 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. | Not_a_variant_type of Longident.t
  32. | Incoherent_label_order
  33. | Less_general of string * Ctype.Unification_trace.t
  34. | Modules_not_allowed
  35. | Cannot_infer_signature
  36. | Not_a_packed_module of Types.type_expr
  37. | Unexpected_existential of existential_restriction * string * string list
  38. | Invalid_interval
  39. | Invalid_for_loop_index
  40. | No_value_clauses
  41. | Exception_pattern_disallowed
  42. | Mixed_value_and_exception_patterns_under_guard
  43. | Inlined_record_escape
  44. | Inlined_record_expected
  45. | Unrefuted_pattern of Typedtree.pattern
  46. | Invalid_extension_constructor_payload
  47. | Not_an_extension_constructor
  48. | Literal_overflow of string
  49. | Unknown_literal of string * char
  50. | Illegal_letrec_pat
  51. | Illegal_letrec_expr
  52. | Illegal_class_expr
  53. | Letop_type_clash of string * Ctype.Unification_trace.t
  54. | Andop_type_clash of string * Ctype.Unification_trace.t
  55. | Bindings_type_clash of Ctype.Unification_trace.t
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 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