2016-02-18 07:11:59 -08:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* OCaml *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
|
|
|
(* en Automatique. *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. This file is distributed under the terms of *)
|
|
|
|
(* the GNU Lesser General Public License version 2.1, with the *)
|
|
|
|
(* special exception on linking described in the file LICENSE. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
1995-08-09 08:06:35 -07:00
|
|
|
|
2019-03-13 03:46:37 -07:00
|
|
|
(** Type-checking of the module language and typed ast hooks
|
2018-09-12 00:51:47 -07:00
|
|
|
|
|
|
|
{b Warning:} this module is unstable and part of
|
2018-09-12 06:36:40 -07:00
|
|
|
{{!Compiler_libs}compiler-libs}.
|
2018-09-12 00:51:47 -07:00
|
|
|
|
|
|
|
*)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1996-09-23 04:33:27 -07:00
|
|
|
open Types
|
2000-03-06 14:12:09 -08:00
|
|
|
open Format
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2018-10-26 07:47:15 -07:00
|
|
|
module Signature_names : sig
|
|
|
|
type t
|
|
|
|
|
|
|
|
val simplify: Env.t -> t -> signature -> signature
|
|
|
|
end
|
2018-07-09 05:23:29 -07:00
|
|
|
|
1998-02-26 04:54:44 -08:00
|
|
|
val type_module:
|
|
|
|
Env.t -> Parsetree.module_expr -> Typedtree.module_expr
|
1995-05-04 03:15:53 -07:00
|
|
|
val type_structure:
|
2020-10-13 00:48:16 -07:00
|
|
|
Env.t -> Parsetree.structure ->
|
2018-10-26 07:47:15 -07:00
|
|
|
Typedtree.structure * Types.signature * Signature_names.t * Env.t
|
2012-06-01 07:05:49 -07:00
|
|
|
val type_toplevel_phrase:
|
2018-07-09 05:23:29 -07:00
|
|
|
Env.t -> Parsetree.structure ->
|
2018-10-26 07:47:15 -07:00
|
|
|
Typedtree.structure * Types.signature * Signature_names.t * Env.t
|
1998-04-27 08:16:48 -07:00
|
|
|
val type_implementation:
|
2020-11-05 10:06:12 -08:00
|
|
|
string -> string -> string -> Env.t -> Parsetree.structure -> Typedtree.t
|
2014-05-07 05:46:00 -07:00
|
|
|
val type_interface:
|
2019-03-13 03:46:37 -07:00
|
|
|
Env.t -> Parsetree.signature -> Typedtree.signature
|
1995-05-04 03:15:53 -07:00
|
|
|
val transl_signature:
|
2012-05-30 07:52:37 -07:00
|
|
|
Env.t -> Parsetree.signature -> Typedtree.signature
|
1995-09-02 11:55:37 -07:00
|
|
|
val check_nongen_schemes:
|
2015-06-23 01:40:10 -07:00
|
|
|
Env.t -> Types.signature -> unit
|
2018-04-08 01:51:15 -07:00
|
|
|
(*
|
2014-05-12 05:02:26 -07:00
|
|
|
val type_open_:
|
2018-02-02 02:44:23 -08:00
|
|
|
?used_slot:bool ref -> ?toplevel:bool ->
|
|
|
|
Asttypes.override_flag ->
|
2014-05-12 05:02:26 -07:00
|
|
|
Env.t -> Location.t -> Longident.t Asttypes.loc -> Path.t * Env.t
|
2018-04-08 01:51:15 -07:00
|
|
|
*)
|
2015-04-23 00:07:43 -07:00
|
|
|
val modtype_of_package:
|
|
|
|
Env.t -> Location.t ->
|
|
|
|
Path.t -> Longident.t list -> type_expr list -> module_type
|
2005-08-08 02:41:52 -07:00
|
|
|
|
2015-07-17 07:31:05 -07:00
|
|
|
val path_of_module : Typedtree.module_expr -> Path.t option
|
|
|
|
|
2014-04-29 04:56:17 -07:00
|
|
|
val save_signature:
|
|
|
|
string -> Typedtree.signature -> string -> string ->
|
2016-08-30 04:11:01 -07:00
|
|
|
Env.t -> Cmi_format.cmi_infos -> unit
|
2012-05-30 07:52:37 -07:00
|
|
|
|
2002-02-08 08:55:44 -08:00
|
|
|
val package_units:
|
2014-04-29 04:56:17 -07:00
|
|
|
Env.t -> string list -> string -> string -> Typedtree.module_coercion
|
2002-02-08 08:55:44 -08:00
|
|
|
|
2018-02-02 02:44:23 -08:00
|
|
|
(* Should be in Envaux, but it breaks the build of the debugger *)
|
|
|
|
val initial_env:
|
2017-01-12 03:56:24 -08:00
|
|
|
loc:Location.t -> safe_string:bool ->
|
|
|
|
initially_opened_module:string option ->
|
2018-02-02 02:44:23 -08:00
|
|
|
open_implicit_modules:string list -> Env.t
|
|
|
|
|
2018-07-09 05:23:29 -07:00
|
|
|
module Sig_component_kind : sig
|
|
|
|
type t =
|
|
|
|
| Value
|
|
|
|
| Type
|
|
|
|
| Module
|
|
|
|
| Module_type
|
|
|
|
| Extension_constructor
|
|
|
|
| Class
|
|
|
|
| Class_type
|
|
|
|
|
|
|
|
val to_string : t -> string
|
|
|
|
end
|
|
|
|
|
2018-10-26 07:47:15 -07:00
|
|
|
type hiding_error =
|
|
|
|
| Illegal_shadowing of {
|
|
|
|
shadowed_item_id: Ident.t;
|
|
|
|
shadowed_item_kind: Sig_component_kind.t;
|
|
|
|
shadowed_item_loc: Location.t;
|
|
|
|
shadower_id: Ident.t;
|
|
|
|
user_id: Ident.t;
|
|
|
|
user_kind: Sig_component_kind.t;
|
|
|
|
user_loc: Location.t;
|
|
|
|
}
|
2018-04-08 01:51:15 -07:00
|
|
|
| Appears_in_signature of {
|
|
|
|
opened_item_id: Ident.t;
|
|
|
|
opened_item_kind: Sig_component_kind.t;
|
|
|
|
user_id: Ident.t;
|
|
|
|
user_kind: Sig_component_kind.t;
|
|
|
|
user_loc: Location.t;
|
|
|
|
}
|
2018-07-09 05:23:29 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
type error =
|
2010-05-18 10:18:24 -07:00
|
|
|
Cannot_apply of module_type
|
1995-05-04 03:15:53 -07:00
|
|
|
| Not_included of Includemod.error list
|
|
|
|
| Cannot_eliminate_dependency of module_type
|
|
|
|
| Signature_expected
|
|
|
|
| Structure_expected of module_type
|
1995-10-01 06:39:43 -07:00
|
|
|
| With_no_component of Longident.t
|
1996-07-25 06:18:53 -07:00
|
|
|
| With_mismatch of Longident.t * Includemod.error list
|
2016-08-29 21:16:28 -07:00
|
|
|
| With_makes_applicative_functor_ill_typed of
|
|
|
|
Longident.t * Path.t * Includemod.error list
|
|
|
|
| With_changes_module_alias of Longident.t * Ident.t * Path.t
|
2017-07-29 18:31:02 -07:00
|
|
|
| With_cannot_remove_constrained_type
|
2018-07-09 05:23:29 -07:00
|
|
|
| Repeated_name of Sig_component_kind.t * string
|
1995-09-02 11:55:37 -07:00
|
|
|
| Non_generalizable of type_expr
|
1998-06-24 12:22:26 -07:00
|
|
|
| Non_generalizable_class of Ident.t * class_declaration
|
1996-05-22 09:22:33 -07:00
|
|
|
| Non_generalizable_module of module_type
|
2004-04-09 06:32:28 -07:00
|
|
|
| Implementation_is_required of string
|
2004-06-13 05:48:01 -07:00
|
|
|
| Interface_not_compiled of string
|
2009-10-26 03:53:16 -07:00
|
|
|
| Not_allowed_in_functor_body
|
2010-10-21 16:59:33 -07:00
|
|
|
| Not_a_packed_module of type_expr
|
|
|
|
| Incomplete_packed_module of type_expr
|
2011-12-14 02:26:15 -08:00
|
|
|
| Scoping_pack of Longident.t * type_expr
|
2013-03-05 08:50:05 -08:00
|
|
|
| Recursive_module_require_explicit_type
|
2013-12-16 19:52:50 -08:00
|
|
|
| Apply_generative
|
2015-10-22 09:11:08 -07:00
|
|
|
| Cannot_scrape_alias of Path.t
|
2020-04-08 11:35:34 -07:00
|
|
|
| Cannot_scrape_package_type of Path.t
|
2018-07-12 13:29:59 -07:00
|
|
|
| Badly_formed_signature of string * Typedecl.error
|
2018-10-26 07:47:15 -07:00
|
|
|
| Cannot_hide_id of hiding_error
|
|
|
|
| Invalid_type_subst_rhs
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2012-01-22 23:59:45 -08:00
|
|
|
exception Error of Location.t * Env.t * error
|
2014-05-07 01:26:17 -07:00
|
|
|
exception Error_forward of Location.error
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2012-01-22 23:59:45 -08:00
|
|
|
val report_error: Env.t -> formatter -> error -> unit
|