jon.recoil.org

Module Includecore

type position = Errortrace.position =
  1. | First
  2. | Second
type primitive_mismatch =
  1. | Name
  2. | Arity
  3. | No_alloc of position
  4. | Builtin
  5. | Effects
  6. | Coeffects
  7. | Native_name
  8. | Result_repr
  9. | Argument_repr of int
  10. | Layout_poly_attr
type layout_poly_coercion =
  1. | Extra_lhs of {
    1. extra : int;
    }
    (*

    first has extra more layout parameters than second.

    *)
  2. | Extra_rhs of {
    1. extra : int;
    }
    (*

    second has extra more layout parameters than first.

    *)
  3. | Instantiate_lhs_to_rhs of {
    1. index_lhs : int;
    2. index_rhs : int;
    }
    (*

    The sort poly var at position index_lhs in first is instantiated with the sort poly var at position index_rhs in second (not position index_lhs as expected).

    *)
  4. | Instantiate_lhs of {
    1. index_lhs : int;
    2. arg : Jkind_types.Sort.t option;
    }
    (*

    The sort poly var at position index_lhs in first is instantiated with arg, which is not any sort poly var of second.

    *)
type value_mismatch =
  1. | Primitive_mismatch of primitive_mismatch
  2. | Not_a_primitive
  3. | Type of Errortrace.moregen_error
  4. | Zero_alloc of Zero_alloc.error
  5. | Modality of Mode.Modality.error
  6. | Mode of Mode.Value.error
  7. | Layout_poly_coercion of layout_poly_coercion
exception Dont_match of value_mismatch
type privacy_mismatch =
  1. | Private_type_abbreviation
  2. | Private_variant_type
  3. | Private_record_type
  4. | Private_record_unboxed_product_type
  5. | Private_extensible_variant
  6. | Private_row_type
type type_kind =
  1. | Kind_abstract
  2. | Kind_record
  3. | Kind_record_unboxed_product
  4. | Kind_variant
  5. | Kind_open
type kind_mismatch = type_kind * type_kind
type label_mismatch =
  1. | Type of Errortrace.equality_error
  2. | Mutability of position
  3. | Atomicity of position
  4. | Modality of Mode.Modality.equate_error
type record_mismatch =
  1. | Label_mismatch of record_change list
  2. | Inlined_representation of position
  3. | Float_representation of position
  4. | Ufloat_representation of position
  5. | Mixed_representation of position
  6. | Mixed_representation_with_flat_floats of position
  7. | Representation_shape_mismatch
type constructor_mismatch =
  1. | Type of Errortrace.equality_error
  2. | Arity
  3. | Inline_record of record_change list
  4. | Kind of position
  5. | Explicit_return_type of position
  6. | Modality of int * Mode.Modality.equate_error
type extension_constructor_mismatch =
  1. | Constructor_privacy
  2. | Constructor_mismatch of Ident.t * Types.extension_constructor * Types.extension_constructor * constructor_mismatch
type private_variant_mismatch =
  1. | Only_outer_closed
  2. | Missing of position * string
  3. | Presence of string
  4. | Incompatible_types_for of string
  5. | Types of Errortrace.equality_error
type private_object_mismatch =
  1. | Missing of string
  2. | Types of Errortrace.equality_error
type unsafe_mode_crossing_mismatch =
  1. | Mode_crossing_only_on of position
  2. | Bounds_not_equal of Types.unsafe_mode_crossing * Types.unsafe_mode_crossing
type type_mismatch =
  1. | Arity
  2. | Privacy of privacy_mismatch
  3. | Kind of kind_mismatch
  4. | Constraint of Errortrace.equality_error
  5. | Manifest of Errortrace.equality_error
  6. | Parameter_jkind of Types.type_expr * Jkind.Violation.t
  7. | Private_variant of Types.type_expr * Types.type_expr * private_variant_mismatch
  8. | Private_object of Types.type_expr * Types.type_expr * private_object_mismatch
  9. | Variance
  10. | Record_mismatch of record_mismatch
  11. | Variant_mismatch of variant_change list
  12. | Unboxed_representation of position * Typedtree.attributes
  13. | Extensible_representation of position
  14. | With_null_representation of position
  15. | Jkind of Jkind.Violation.t
  16. | Unsafe_mode_crossing of unsafe_mode_crossing_mismatch
type jkind_mismatch =
  1. | Manifest_missing
  2. | Manifest_mismatch
type mmodes =
  1. | All
    (*

    Check module inclusion M1 : MT1 @ m <= MT2 @ m for all m.

    *)
  2. | Specific : ((Mode.allowed * 'r) Mode.Value.t * Typedtree.held_locks option) * ('l * Mode.allowed) Mode.Value.t -> mmodes
    (*

    Check module inclusion M1 : MT1 @ m1 <= MT2 @ m2.

    No prior constraint between m1 and m2 is given. In particular, it's possible that m1 >= m2. For example, if m1 = nonportable >= portable = m2 and MT2 = sig end, the inclusion check should pass. This finer treatment is necessary for ergonomics.

    Another ergonomics is wrt closing over modules. If M1 is a Pmod_ident, all surrounding functions would naively close over M1. However, if M1 = nonportable and MT2 = sig end, surrounding functions shouldn't be forced to nonportable. To that end, the locks leading to M1 is not walked immediately upon look-up, but held and passed to inclusion check for finer treatment. This is the third constructor argument. This is similar to the ergonomics in Typecore.type_ident wrt projections out of modules.

    *)

Describes the modes of modules on both sides, passed to inclusion check.

val child_modes : string -> mmodes -> mmodes

Gives the modes suitable for the inclusion check of a child item, where there is no modality between the parent and the child. Takes the modes suitable for the parent item.

val child_modes_with_modalities : string -> modalities:(Mode.Modality.t * Mode.Modality.t) -> mmodes -> (mmodes, Mode.Modality.error) Result.t

Gives the modes suitable for the inclusion check of a child item. Takes the modes suitable for the inclusion check of the parent item, and both hands' modalities between the parent and the child.

val check_modes : Env.t -> ?crossing:Mode.Crossing.t -> item:Mode.Hint.lock_item -> ?typ:Types.type_expr -> mmodes -> (unit, Mode.Value.error) Result.t

Claim the current item is included by the RHS and its mode checked.

val value_descriptions : loc:Location.t -> Env.t -> string -> mmodes:mmodes -> Types.value_description -> Types.value_description -> Typedtree.module_coercion
val type_declarations : ?equality:bool -> loc:Location.t -> Env.t -> mark:bool -> string -> Types.type_declaration -> Path.t -> Types.type_declaration -> type_mismatch option
val extension_constructors : loc:Location.t -> Env.t -> mark:bool -> Ident.t -> Types.extension_constructor -> Types.extension_constructor -> extension_constructor_mismatch option
val jkind_declarations : loc:Location.t -> Env.t -> string -> Types.jkind_declaration -> Types.jkind_declaration -> jkind_mismatch option
val report_value_mismatch : pp:Mode.Hint.pinpoint -> string -> string -> Env.t -> value_mismatch Format_doc.printer
val report_type_mismatch : string -> string -> string -> Env.t -> type_mismatch Format_doc.printer
val report_modality_sub_error : string -> string -> Format_doc.formatter -> Mode.Modality.error -> unit
val report_mode_sub_error : pp:Mode.Hint.pinpoint -> string -> string -> Format_doc.formatter -> Mode.Value.error -> unit
val report_extension_constructor_mismatch : string -> string -> string -> Env.t -> extension_constructor_mismatch Format_doc.printer
val report_jkind_mismatch : string -> string -> Format_doc.formatter -> jkind_mismatch -> unit