jon.recoil.org

Module 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_module : Env.t -> ?expected_mode:Mode.Value.r -> Parsetree.module_expr -> Typedtree.module_expr * Shape.t
val type_interface : sourcefile:string -> Compilation_unit.t -> Env.t -> Parsetree.signature -> Typedtree.signature
val check_nongen_signature : Env.t -> Types.signature -> unit
val modtype_of_package : Env.t -> Location.t -> Path.t -> (Longident.t * Types.type_expr) list -> Types.module_type
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: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 : Typemod.Sig_component_kind.t;
    3. shadowed_item_loc : Location.t;
    4. shadower_id : Ident.t;
    5. user_id : Ident.t;
    6. user_kind : Typemod.Sig_component_kind.t;
    7. user_loc : Location.t;
    }
  2. | Appears_in_signature of {
    1. opened_item_id : Ident.t;
    2. opened_item_kind : Typemod.Sig_component_kind.t;
    3. user_id : Ident.t;
    4. user_kind : Typemod.Sig_component_kind.t;
    5. user_loc : 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 Typemod.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 Longident.t
  12. | With_mismatch of Longident.t * Includemod.explanation
  13. | With_makes_applicative_functor_ill_typed of Longident.t * Path.t * Includemod.explanation
  14. | With_changes_module_alias of Longident.t * Ident.t * Path.t
  15. | With_cannot_remove_constrained_type
  16. | With_package_manifest of Longident.t * Types.type_expr
  17. | Repeated_name of Typemod.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 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 Typemod.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 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 * Misc.filepath
  41. | Argument_for_non_parameter of Global_module.Name.t * 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 : 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 Typemod.unsupported_modal_module
  48. | Legacy_module of Typemod.legacy_module * Mode.Value.error
exception Error of Location.t * Env.t * Typemod.error
exception Error_forward of Location.error
val report_error : Env.t -> loc:Location.t -> Typemod.error -> 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.