Module Ocaml_typing.CtypeSource

Sourceexception Equality of Errortrace.equality_error
Sourceexception Moregen of Errortrace.moregen_error
Sourceexception Subtype of Errortrace.Subtype.error
Sourceexception Cannot_expand
Sourceexception Cannot_apply
Sourceexception Matches_failure of Env.t * Errortrace.unification_error
Sourceexception Incompatible
Sourceval with_local_level : ?post:('a -> unit) -> (unit -> 'a) -> 'a
Sourceval with_local_level_if : bool -> (unit -> 'a) -> post:('a -> unit) -> 'a
Sourceval with_local_level_iter : (unit -> 'a * 'b list) -> post:('b -> unit) -> 'a
Sourceval with_local_level_iter_if : bool -> (unit -> 'a * 'b list) -> post:('b -> unit) -> 'a
Sourceval with_level : level:int -> (unit -> 'a) -> 'a
Sourceval with_level_if : bool -> level:int -> (unit -> 'a) -> 'a
Sourceval with_local_level_if_principal : (unit -> 'a) -> post:('a -> unit) -> 'a
Sourceval with_local_level_iter_if_principal : (unit -> 'a * 'b list) -> post:('b -> unit) -> 'a
Sourceval with_local_level_for_class : ?post:('a -> unit) -> (unit -> 'a) -> 'a
Sourceval with_raised_nongen_level : (unit -> 'a) -> 'a
Sourceval reset_global_level : unit -> unit
Sourceval increase_global_level : unit -> int
Sourceval restore_global_level : int -> unit
Sourcetype levels = {
  1. current_level : int;
  2. nongen_level : int;
  3. global_level : int;
  4. saved_level : (int * int) list;
}
Sourceval save_levels : unit -> levels
Sourceval set_levels : levels -> unit
Sourceval create_scope : unit -> int
Sourceval new_scoped_ty : int -> Types.type_desc -> Types.type_expr
Sourceval newvar : ?name:string -> unit -> Types.type_expr
Sourceval newvar2 : ?name:string -> int -> Types.type_expr
Sourceval new_global_var : ?name:string -> unit -> Types.type_expr
Sourceval newconstr : Path.t -> Types.type_expr list -> Types.type_expr
Sourceval object_fields : Types.type_expr -> Types.type_expr
Sourceval flatten_fields : Types.type_expr -> (string * Types.field_kind * Types.type_expr) list * Types.type_expr

Transform a field type into a list of pairs label-type. The fields are sorted.

Beware of the interaction with GADTs:

Due to the introduction of object indexes for GADTs, the row variable of an object may now be an expansible type abbreviation. A first consequence is that flatten_fields will not completely flatten the object, since the type abbreviation will not be expanded (flatten_fields does not receive the current environment). Another consequence is that various functions may be called with the expansion of this type abbreviation, which is a Tfield, e.g. during printing.

Concrete problems have been fixed, but new bugs may appear in the future. (Test cases were added to typing-gadts/test.ml)

Sourceval associate_fields : (string * Types.field_kind * Types.type_expr) list -> (string * Types.field_kind * Types.type_expr) list -> (string * Types.field_kind * Types.type_expr * Types.field_kind * Types.type_expr) list * (string * Types.field_kind * Types.type_expr) list * (string * Types.field_kind * Types.type_expr) list
Sourceval opened_object : Types.type_expr -> bool
Sourceval set_object_name : Ident.t -> Types.type_expr list -> Types.type_expr -> unit
Sourceval remove_object_name : Types.type_expr -> unit
Sourceval find_cltype_for_path : Env.t -> Path.t -> Types.type_declaration * Types.type_expr
Sourceval generalize : Types.type_expr -> unit
Sourceval lower_contravariant : Env.t -> Types.type_expr -> unit
Sourceval lower_variables_only : Env.t -> int -> Types.type_expr -> unit
Sourceval enforce_current_level : Env.t -> Types.type_expr -> unit
Sourceval generalize_structure : Types.type_expr -> unit
Sourceval generalize_class_type : Types.class_type -> unit
Sourceval generalize_class_type_structure : Types.class_type -> unit
Sourceval generalize_class_signature_spine : Env.t -> Types.class_signature -> unit
Sourceval correct_levels : Types.type_expr -> Types.type_expr
Sourceval limited_generalize : Types.type_expr -> Types.type_expr -> unit
Sourceval limited_generalize_class_type : Types.type_expr -> Types.class_type -> unit
Sourceval fully_generic : Types.type_expr -> bool
Sourceval check_scope_escape : Env.t -> int -> Types.type_expr -> unit
Sourceval instance : ?partial:bool -> Types.type_expr -> Types.type_expr
Sourceval generic_instance : Types.type_expr -> Types.type_expr
Sourceval instance_list : Types.type_expr list -> Types.type_expr list
Sourceval new_local_type : ?loc:Ocaml_parsing.Location.t -> ?manifest_and_scope:(Types.type_expr * int) -> unit -> Types.type_declaration
Sourceval existential_name : Types.constructor_description -> Types.type_expr -> string
Sourcetype existential_treatment =
  1. | Keep_existentials_flexible
  2. | Make_existentials_abstract of {
    1. env : Env.t ref;
    2. scope : int;
    }
Sourceval instance_parameterized_type : ?keep_names:bool -> Types.type_expr list -> Types.type_expr -> Types.type_expr list * Types.type_expr
Sourceval generic_instance_declaration : Types.type_declaration -> Types.type_declaration
Sourceval instance_poly : ?keep_names:bool -> bool -> Types.type_expr list -> Types.type_expr -> Types.type_expr list * Types.type_expr
Sourceval apply : ?use_current_level:bool -> Env.t -> Types.type_expr list -> Types.type_expr -> Types.type_expr list -> Types.type_expr
Sourceval try_expand_once_opt : Env.t -> Types.type_expr -> Types.type_expr
Sourceval try_expand_safe_opt : Env.t -> Types.type_expr -> Types.type_expr
Sourceval expand_head_once : Env.t -> Types.type_expr -> Types.type_expr
Sourceval expand_head_opt : Env.t -> Types.type_expr -> Types.type_expr

The compiler's own version of expand_head necessary for type-based optimisations.

Expansion of types for error traces; lives here instead of in Errortrace because the expansion machinery lives here.

Sourceval expanded_diff : Env.t -> got:Types.type_expr -> expected:Types.type_expr -> (Errortrace.expanded_type, 'variant) Errortrace.elt

Create an Errortrace.Diff by expanding the two types

Sourceval unexpanded_diff : got:Types.type_expr -> expected:Types.type_expr -> (Errortrace.expanded_type, 'variant) Errortrace.elt

Create an Errortrace.Diff by *duplicating* the two types, so that each one's expansion is identical to itself. Despite the name, does create Errortrace.expanded_types.

Sourceval full_expand : may_forget_scope:bool -> Env.t -> Types.type_expr -> Types.type_expr
Sourcetype typedecl_extraction_result =
  1. | Typedecl of Path.t * Path.t * Types.type_declaration
  2. | Has_no_typedecl
  3. | May_have_typedecl
Sourceval extract_concrete_typedecl : Env.t -> Types.type_expr -> typedecl_extraction_result
Sourceval unify : Env.t -> Types.type_expr -> Types.type_expr -> unit
Sourceval unify_gadt : equations_level:int -> allow_recursive_equations:bool -> Env.t ref -> Types.type_expr -> Types.type_expr -> Btype.TypePairs.t
Sourceval unify_var : Env.t -> Types.type_expr -> Types.type_expr -> unit
Sourceval filter_method : Env.t -> string -> Types.type_expr -> Types.type_expr
Sourceval occur_in : Env.t -> Types.type_expr -> Types.type_expr -> bool
Sourceval deep_occur : Types.type_expr -> Types.type_expr -> bool
Sourceval moregeneral : Env.t -> bool -> Types.type_expr -> Types.type_expr -> unit
Sourceval is_moregeneral : Env.t -> bool -> Types.type_expr -> Types.type_expr -> bool
Sourceval rigidify : Types.type_expr -> Types.type_expr list
Sourceval all_distinct_vars : Env.t -> Types.type_expr list -> bool
Sourceval matches : expand_error_trace:bool -> Env.t -> Types.type_expr -> Types.type_expr -> unit
Sourceval does_match : Env.t -> Types.type_expr -> Types.type_expr -> bool
Sourceval reify_univars : Env.t -> Types.type_expr -> Types.type_expr
Sourcetype filter_arrow_failure =
  1. | Unification_error of Errortrace.unification_error
  2. | Label_mismatch of {
    1. got : Ocaml_parsing.Asttypes.arg_label;
    2. expected : Ocaml_parsing.Asttypes.arg_label;
    3. expected_type : Types.type_expr;
    }
  3. | Not_a_function
Sourceexception Filter_arrow_failed of filter_arrow_failure
Sourcetype filter_method_failure =
  1. | Unification_error of Errortrace.unification_error
  2. | Not_a_method
  3. | Not_an_object of Types.type_expr
Sourceexception Filter_method_failed of filter_method_failure
Sourcetype class_match_failure =
  1. | CM_Virtual_class
  2. | CM_Parameter_arity_mismatch of int * int
  3. | CM_Type_parameter_mismatch of Env.t * Errortrace.equality_error
  4. | CM_Class_type_mismatch of Env.t * Types.class_type * Types.class_type
  5. | CM_Parameter_mismatch of Env.t * Errortrace.moregen_error
  6. | CM_Val_type_mismatch of string * Env.t * Errortrace.comparison_error
  7. | CM_Meth_type_mismatch of string * Env.t * Errortrace.comparison_error
  8. | CM_Non_mutable_value of string
  9. | CM_Non_concrete_value of string
  10. | CM_Missing_value of string
  11. | CM_Missing_method of string
  12. | CM_Hide_public of string
  13. | CM_Hide_virtual of string * string
  14. | CM_Public_method of string
  15. | CM_Private_method of string
  16. | CM_Virtual_method of string
Sourceval match_class_types : ?trace:bool -> Env.t -> Types.class_type -> Types.class_type -> class_match_failure list
Sourceval equal : Env.t -> bool -> Types.type_expr list -> Types.type_expr list -> unit
Sourceval is_equal : Env.t -> bool -> Types.type_expr list -> Types.type_expr list -> bool
Sourceval equal_private : Env.t -> Types.type_expr list -> Types.type_expr -> Types.type_expr list -> Types.type_expr -> unit
Sourceval match_class_declarations : Env.t -> Types.type_expr list -> Types.class_type -> Types.type_expr list -> Types.class_type -> class_match_failure list
Sourceval enlarge_type : Env.t -> Types.type_expr -> Types.type_expr * bool
Sourceval subtype : Env.t -> Types.type_expr -> Types.type_expr -> unit -> unit
Sourceval new_class_signature : unit -> Types.class_signature
Sourceval add_dummy_method : Env.t -> scope:int -> Types.class_signature -> unit
Sourcetype add_method_failure =
  1. | Unexpected_method
  2. | Type_mismatch of Errortrace.unification_error
Sourceexception Add_method_failed of add_method_failure
Sourcetype add_instance_variable_failure =
  1. | Mutability_mismatch of Ocaml_parsing.Asttypes.mutable_flag
  2. | Type_mismatch of Errortrace.unification_error
Sourceexception Add_instance_variable_failed of add_instance_variable_failure
Sourcetype inherit_class_signature_failure =
  1. | Self_type_mismatch of Errortrace.unification_error
  2. | Method of Ocaml_parsing.Asttypes.label * add_method_failure
  3. | Instance_variable of Ocaml_parsing.Asttypes.label * add_instance_variable_failure
Sourceexception Inherit_class_signature_failed of inherit_class_signature_failure
Sourceval inherit_class_signature : strict:bool -> Env.t -> Types.class_signature -> Types.class_signature -> unit
Sourceval hide_private_methods : Env.t -> Types.class_signature -> unit
Sourceval close_class_signature : Env.t -> Types.class_signature -> bool
Sourceexception Nondep_cannot_erase of Ident.t
Sourceval nondep_type : Env.t -> Ident.t list -> Types.type_expr -> Types.type_expr
Sourceval nondep_type_decl : Env.t -> Ident.t list -> bool -> Types.type_declaration -> Types.type_declaration
Sourceval nondep_extension_constructor : Env.t -> Ident.t list -> Types.extension_constructor -> Types.extension_constructor
Sourceval nondep_class_declaration : Env.t -> Ident.t list -> Types.class_declaration -> Types.class_declaration
Sourceval is_contractive : Env.t -> Path.t -> bool
Sourceval normalize_type : Types.type_expr -> unit
Sourceval nongen_vars_in_schema : Env.t -> Types.type_expr -> Btype.TypeSet.t option
Sourceval nongen_vars_in_class_declaration : Types.class_declaration -> Btype.TypeSet.t option
Sourcetype variable_kind =
  1. | Row_variable
  2. | Type_variable
Sourcetype closed_class_failure = {
  1. free_variable : Types.type_expr * variable_kind;
  2. meth : string;
  3. meth_ty : Types.type_expr;
}
Sourceval free_variables : ?env:Env.t -> Types.type_expr -> Types.type_expr list
Sourceval closed_type_decl : Types.type_declaration -> Types.type_expr option
Sourceval closed_extension_constructor : Types.extension_constructor -> Types.type_expr option
Sourceval arity : Types.type_expr -> int
Sourceval collapse_conj_params : Env.t -> Types.type_expr list -> unit
Sourceval get_current_level : unit -> int
Sourceval wrap_trace_gadt_instances : Env.t -> ('a -> 'b) -> 'a -> 'b
Sourceval mcomp : Env.t -> Types.type_expr -> Types.type_expr -> unit