Module Ocaml_typing.Typemod

Type-checking of the module language and typed ast hooks

Warning: this module is unstable and part of compiler-libs.

module Signature_names : sig ... end
val type_interface : sourcefile:string -> Compilation_unit.t -> Env.t -> Ocaml_parsing.Parsetree.signature -> Typedtree.signature
val check_nongen_signature : Env.t -> Types.signature -> unit
val path_of_module : Typedtree.module_expr -> Path.t option
val package_units : Env.t -> string list -> Unit_info.Artifact.t -> Compilation_unit.t -> Typedtree.module_coercion
val initial_env : loc:Ocaml_parsing.Location.t -> initially_opened_module:string option -> open_implicit_modules:string list -> Env.t
module Sig_component_kind : sig ... end
type hiding_error =
  1. | Illegal_shadowing of {
    1. shadowed_item_id : Ident.t;
    2. shadowed_item_kind : Sig_component_kind.t;
    3. shadowed_item_loc : Ocaml_parsing.Location.t;
    4. shadower_id : Ident.t;
    5. user_id : Ident.t;
    6. user_kind : Sig_component_kind.t;
    7. user_loc : Ocaml_parsing.Location.t;
    }
  2. | Appears_in_signature of {
    1. opened_item_id : Ident.t;
    2. opened_item_kind : Sig_component_kind.t;
    3. user_id : Ident.t;
    4. user_kind : Sig_component_kind.t;
    5. user_loc : Ocaml_parsing.Location.t;
    }
type functor_dependency_error =
  1. | Functor_applied
  2. | Functor_included
type legacy_module =
  1. | Compilation_unit
  2. | Toplevel
  3. | Functor_body

Modules that are required to be legacy mode

type unsupported_modal_module =
  1. | Functor_param
  2. | Functor_res

Places where modes annotations are not supported

type error =
  1. | Cannot_apply of Types.module_type
  2. | Not_included of Includemod.explanation
  3. | Not_included_functor of Includemod.explanation
  4. | Cannot_eliminate_dependency of functor_dependency_error * Types.module_type
  5. | Signature_expected
  6. | Structure_expected of Types.module_type
  7. | Functor_expected of Types.module_type
  8. | Signature_parameter_expected of Types.module_type
  9. | Signature_result_expected of Types.module_type
  10. | Recursive_include_functor
  11. | With_no_component of Ocaml_parsing.Longident.t
  12. | With_mismatch of Ocaml_parsing.Longident.t * Includemod.explanation
  13. | With_makes_applicative_functor_ill_typed of Ocaml_parsing.Longident.t * Path.t * Includemod.explanation
  14. | With_changes_module_alias of Ocaml_parsing.Longident.t * Ident.t * Path.t
  15. | With_cannot_remove_constrained_type
  16. | With_package_manifest of Ocaml_parsing.Longident.t * Types.type_expr
  17. | Repeated_name of Sig_component_kind.t * string
  18. | Non_generalizable of {
    1. vars : Types.type_expr list;
    2. expression : Types.type_expr;
    }
  19. | Non_generalizable_module of {
    1. vars : Types.type_expr list;
    2. item : Types.value_description;
    3. mty : Types.module_type;
    }
  20. | Implementation_is_required of string
  21. | Interface_not_compiled of string
  22. | Not_allowed_in_functor_body
  23. | Not_includable_in_functor_body
  24. | Not_a_packed_module of Types.type_expr
  25. | Incomplete_packed_module of Types.type_expr
  26. | Scoping_pack of Ocaml_parsing.Longident.t * Types.type_expr
  27. | Recursive_module_require_explicit_type
  28. | Apply_generative
  29. | Cannot_scrape_alias of Path.t
  30. | Cannot_scrape_package_type of Path.t
  31. | Badly_formed_signature of string * Typedecl.error
  32. | Cannot_hide_id of hiding_error
  33. | Invalid_type_subst_rhs
  34. | Non_packable_local_modtype_subst of Path.t
  35. | With_cannot_remove_packed_modtype of Path.t * Types.module_type
  36. | Strengthening_mismatch of Ocaml_parsing.Longident.t * Includemod.explanation
  37. | Cannot_pack_parameter
  38. | Compiling_as_parameterised_parameter
  39. | Cannot_compile_implementation_as_parameter
  40. | Cannot_implement_parameter of Compilation_unit.Name.t * Merlin_utils.Misc.filepath
  41. | Argument_for_non_parameter of Global_module.Name.t * Merlin_utils.Misc.filepath
  42. | Cannot_find_argument_type of Global_module.Parameter_name.t
  43. | Inconsistent_argument_types of {
    1. new_arg_type : Global_module.Parameter_name.t option;
    2. old_arg_type : Global_module.Parameter_name.t option;
    3. old_source_file : Merlin_utils.Misc.filepath;
    }
  44. | Duplicate_parameter_name of Global_module.Parameter_name.t
  45. | Submode_failed of Mode.Value.error
  46. | Item_weaker_than_structure of Mode.Value.error
  47. | Unsupported_modal_module of unsupported_modal_module
  48. | Legacy_module of legacy_module * Mode.Value.error
exception Error of Ocaml_parsing.Location.t * Env.t * error
exception Error_forward of Ocaml_parsing.Location.error
val reset : preserve_persistent_env:bool -> unit

Clear several bits of global state that may retain large amounts of memory after typechecking is finished.

val normalize_signature : Types.signature -> unit