jon.recoil.org

Module Typecore

type comprehension_type =
  1. | List_comprehension
  2. | Array_comprehension of Types.mutability
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
  11. | Comprehension_in_iterator of Typecore.comprehension_type
  12. | Comprehension_for_start
  13. | Comprehension_for_stop
  14. | Comprehension_when
  15. | Error_message_attr of string
type type_expected = private {
  1. ty : Types.type_expr;
  2. explanation : Typecore.type_forcing_context option;
}
type pattern_variable = {
  1. pv_id : Ident.t;
  2. pv_uid : Types.Uid.t;
  3. pv_mode : Mode.Value.l;
  4. pv_kind : Types.value_kind;
  5. pv_type : Types.type_expr;
  6. pv_loc : Location.t;
  7. pv_as_var : bool;
  8. pv_attributes : Typedtree.attributes;
  9. pv_sort : Jkind.Sort.t;
}
val is_nonexpansive : Typedtree.expression -> bool
module Datatype_kind : sig ... end
type wrong_name = {
  1. type_path : Path.t;
  2. kind : Typecore.Datatype_kind.t;
  3. name : string Asttypes.loc;
  4. valid_names : string list;
}
type wrong_kind_context =
  1. | Pattern
  2. | Expression of Typecore.type_forcing_context option
type wrong_kind_sort =
  1. | Constructor
  2. | Record
  3. | Record_unboxed_product
  4. | Boolean
  5. | List
  6. | 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 mutable_restriction =
  1. | In_group
  2. | In_rec
type module_patterns_restriction =
  1. | Modules_allowed of {
    1. scope : int;
    }
  2. | Modules_rejected
  3. | Modules_ignored
val type_binding : Env.t -> Asttypes.mutable_flag -> Asttypes.rec_flag -> ?force_toplevel:bool -> Parsetree.value_binding list -> Typedtree.value_binding list * Env.t
val type_expression : Env.t -> Parsetree.expression -> Typedtree.expression
val type_class_arg_pattern : string -> Env.t -> Env.t -> Types.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 type_approx : Env.t -> Parsetree.expression -> Types.type_expr -> unit
val type_option_none : Env.t -> Types.type_expr -> Location.t -> Typedtree.expression
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 reset_allocations : unit -> unit
val optimise_allocations : unit -> unit
val has_poly_constraint : Parsetree.pattern -> bool
val name_pattern : string -> Typedtree.pattern list -> Ident.t * Types.Uid.t
val name_cases : string -> Typedtree.value Typedtree.case list -> Ident.t * Types.Uid.t
type submode_reason =
  1. | Application of Types.type_expr
  2. | Constructor of Longident.t
  3. | Other
val escape : loc:Location.t -> env:Env.t -> reason:Typecore.submode_reason -> (Mode.allowed * 'r) Mode.Value.t -> unit
val self_coercion : (Path.t * Location.t list Stdlib.ref) list Stdlib.ref
type unsupported_stack_allocation =
  1. | Lazy
  2. | Module
  3. | Object
  4. | List_comprehension
  5. | Array_comprehension
type error =
  1. | Constructor_arity_mismatch of Longident.t * int * int
  2. | Constructor_labeled_arg
  3. | Partial_tuple_pattern_bad_type
  4. | Extra_tuple_label of string option * Types.type_expr
  5. | Missing_tuple_label of string option * Types.type_expr
  6. | Label_mismatch of Types.record_form_packed * Longident.t * Errortrace.unification_error
  7. | Pattern_type_clash : Errortrace.unification_error * Parsetree.pattern_desc option -> Typecore.error
  8. | Or_pattern_type_clash of Ident.t * Errortrace.unification_error
  9. | Multiply_bound_variable of string
  10. | Orpat_vars of Ident.t * Ident.t list
  11. | Expr_type_clash of Errortrace.unification_error * Typecore.type_forcing_context option * Parsetree.expression_desc option
  12. | Function_arity_type_clash of {
    1. syntactic_arity : int;
    2. type_constraint : Types.type_expr;
    3. trace : Errortrace.unification_error;
    }
  13. | 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;
    }
  14. | Apply_wrong_label of Types.arg_label * Types.type_expr * bool
  15. | Label_multiply_defined of string
  16. | Label_missing of Types.record_form_packed * Ident.t list
  17. | Label_not_mutable of Longident.t
  18. | Wrong_name of string * Typecore.type_expected * Typecore.wrong_name
  19. | Name_type_mismatch of Typecore.Datatype_kind.t * Longident.t * Path.t * Path.t * (Path.t * Path.t) list
  20. | Invalid_format of string
  21. | Not_an_object of Types.type_expr * Typecore.type_forcing_context option
  22. | Non_value_object of Jkind.Violation.t * Typecore.type_forcing_context option
  23. | Non_value_let_rec of Jkind.Violation.t * Types.type_expr
  24. | Undefined_method of Types.type_expr * string * string list option
  25. | Undefined_self_method of string * string list
  26. | Virtual_class of Longident.t
  27. | Private_type of Types.type_expr
  28. | Private_label of Longident.t * Types.type_expr
  29. | Private_constructor of Types.constructor_description * Types.type_expr
  30. | Unbound_instance_variable of string * string list
  31. | Instance_variable_not_mutable of string
  32. | Not_subtype of Errortrace.Subtype.error
  33. | Outside_class
  34. | Value_multiply_overridden of string
  35. | Coercion_failure of Errortrace.expanded_type * Errortrace.unification_error * bool
  36. | Not_a_function of Types.type_expr * Typecore.type_forcing_context option
  37. | Too_many_arguments of Types.type_expr * Typecore.type_forcing_context option
  38. | Abstract_wrong_label of {
    1. got : Types.arg_label;
    2. expected : Types.arg_label;
    3. expected_type : Types.type_expr;
    4. explanation : Typecore.type_forcing_context option;
    }
  39. | Scoping_let_module of string * Types.type_expr
  40. | Not_a_polymorphic_variant_type of Longident.t
  41. | Incoherent_label_order
  42. | Less_general of string * Errortrace.unification_error
  43. | Modules_not_allowed
  44. | Cannot_infer_signature
  45. | Not_a_packed_module of Types.type_expr
  46. | Unexpected_existential of Typecore.existential_restriction * string
  47. | Unexpected_mutable of Typecore.mutable_restriction
  48. | Invalid_interval
  49. | Invalid_for_loop_index
  50. | Invalid_comprehension_for_range_iterator_index
  51. | No_value_clauses
  52. | Exception_pattern_disallowed
  53. | Mixed_value_and_exception_patterns_under_guard
  54. | Inlined_record_escape
  55. | Inlined_record_expected
  56. | Unrefuted_pattern of Typedtree.pattern
  57. | Invalid_extension_constructor_payload
  58. | Not_an_extension_constructor
  59. | Probe_format
  60. | Probe_name_format of string
  61. | Probe_name_undefined of string
  62. | Probe_is_enabled_format
  63. | Extension_not_enabled : _ Language_extension.t -> Typecore.error
  64. | Atomic_in_pattern of Longident.t
  65. | Invalid_atomic_loc_payload
  66. | Label_not_atomic of Longident.t
  67. | Modalities_on_atomic_field of Longident.t
  68. | Literal_overflow of string
  69. | Unknown_literal of string * char
  70. | Float32_literal of string
  71. | Int8_literal of string
  72. | Int16_literal of string
  73. | Untagged_char_literal of char
  74. | Illegal_letrec_pat
  75. | Illegal_letrec_expr
  76. | Illegal_mutable_pat
  77. | Illegal_class_expr
  78. | Letop_type_clash of string * Errortrace.unification_error
  79. | Andop_type_clash of string * Errortrace.unification_error
  80. | Bindings_type_clash of Errortrace.unification_error
  81. | Unbound_existential of Ident.t list * Types.type_expr
  82. | Missing_type_constraint
  83. | Wrong_expected_kind of Typecore.wrong_kind_sort * Typecore.wrong_kind_context * Types.type_expr
  84. | Wrong_expected_record_boxing of Typecore.wrong_kind_context * Types.record_form_packed * Types.type_expr
  85. | Expr_not_a_record_type of Types.record_form_packed * Types.type_expr
  86. | Expr_record_type_has_wrong_boxing of Types.record_form_packed * Types.type_expr
  87. | Invalid_unboxed_access of {
    1. prev_el_type : Types.type_expr;
    2. ua : Parsetree.unboxed_access;
    }
  88. | Block_access_record_unboxed
  89. | Block_access_private_record
  90. | Block_index_flattened_record of Types.type_expr
  91. | Block_index_modality_mismatch of {
    1. mut : bool;
    2. err : Mode.Modality.equate_error;
    }
  92. | Block_index_atomic_unsupported
  93. | Submode_failed of Mode.Value.error * Typecore.submode_reason
  94. | Curried_application_complete of Types.arg_label * Mode.Alloc.error * [ `Prefix | `Single_arg | `Entire_apply ]
  95. | Param_mode_mismatch of Mode.Alloc.equate_error
  96. | Uncurried_function_escapes of Mode.Alloc.error
  97. | Function_returns_local
  98. | Tail_call_local_returning
  99. | Bad_tail_annotation of [ `Conflict | `Not_a_tailcall ]
  100. | Optional_poly_param
  101. | Exclave_in_nontail_position
  102. | Exclave_returns_not_local
  103. | Unboxed_int_literals_not_supported
  104. | Function_type_not_rep of Types.type_expr * Jkind.Violation.t
  105. | Record_projection_not_rep of Types.type_expr * Jkind.Violation.t
  106. | Record_not_rep of Types.type_expr * Jkind.Violation.t
  107. | Mutable_var_not_rep of Types.type_expr * Jkind.Violation.t
  108. | Invalid_label_for_src_pos of Types.arg_label
  109. | Nonoptional_call_pos_label of string
  110. | Unsupported_stack_allocation of Typecore.unsupported_stack_allocation
  111. | Not_allocation
  112. | Impossible_function_jkind of {
    1. some_args_ok : bool;
    2. ty_fun : Types.type_expr;
    3. jkind : Types.jkind_lr;
    }
  113. | Overwrite_of_invalid_term
  114. | Unexpected_hole
  115. | Eval_format
exception Error of Location.t * Env.t * Typecore.error
exception Error_forward of Location.error
val type_open_decl : (?used_slot:bool Stdlib.ref -> Env.t -> Parsetree.open_declaration -> Typedtree.open_declaration * Env.t) Stdlib.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