1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
(* Typechecking of type expressions for the core language *)
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
open Format;;
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
val transl_simple_type:
|
2010-09-30 21:57:43 -07:00
|
|
|
Env.t -> bool -> Parsetree.core_type -> Types.type_expr
|
2002-04-18 00:27:47 -07:00
|
|
|
val transl_simple_type_univars:
|
|
|
|
Env.t -> Parsetree.core_type -> Types.type_expr
|
1997-01-20 09:11:47 -08:00
|
|
|
val transl_simple_type_delayed:
|
|
|
|
Env.t -> Parsetree.core_type -> Types.type_expr * (unit -> unit)
|
|
|
|
(* Translate a type, but leave type variables unbound. Returns
|
|
|
|
the type and a function that binds the type variable. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
val transl_type_scheme:
|
1996-09-23 04:33:27 -07:00
|
|
|
Env.t -> Parsetree.core_type -> Types.type_expr
|
1995-05-04 03:15:53 -07:00
|
|
|
val reset_type_variables: unit -> unit
|
2003-03-07 00:59:15 -08:00
|
|
|
val enter_type_variable: bool -> Location.t -> string -> Types.type_expr
|
2002-08-04 22:58:08 -07:00
|
|
|
val type_variable: Location.t -> string -> Types.type_expr
|
|
|
|
|
|
|
|
type variable_context
|
|
|
|
val narrow: unit -> variable_context
|
|
|
|
val widen: variable_context -> unit
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
exception Already_bound
|
|
|
|
|
|
|
|
type error =
|
|
|
|
Unbound_type_variable of string
|
|
|
|
| Unbound_type_constructor of Longident.t
|
2001-11-27 18:14:39 -08:00
|
|
|
| Unbound_type_constructor_2 of Path.t
|
1995-05-04 03:15:53 -07:00
|
|
|
| Type_arity_mismatch of Longident.t * int * int
|
1996-04-22 04:15:41 -07:00
|
|
|
| Bound_type_variable of string
|
|
|
|
| Recursive_type
|
|
|
|
| Unbound_row_variable of Longident.t
|
1997-02-20 12:39:02 -08:00
|
|
|
| Type_mismatch of (Types.type_expr * Types.type_expr) list
|
|
|
|
| Alias_type_mismatch of (Types.type_expr * Types.type_expr) list
|
1999-11-30 08:07:38 -08:00
|
|
|
| Present_has_conjunction of string
|
|
|
|
| Present_has_no_type of string
|
2001-09-25 02:54:18 -07:00
|
|
|
| Constructor_mismatch of Types.type_expr * Types.type_expr
|
|
|
|
| Not_a_variant of Types.type_expr
|
2002-01-03 18:02:50 -08:00
|
|
|
| Variant_tags of string * string
|
2003-03-07 00:59:15 -08:00
|
|
|
| Invalid_variable_name of string
|
2003-05-19 02:21:17 -07:00
|
|
|
| Cannot_quantify of string * Types.type_expr
|
2009-10-26 03:53:16 -07:00
|
|
|
| Multiple_constraints_on_type of string
|
2010-01-20 08:26:46 -08:00
|
|
|
| Repeated_method_label of string
|
2010-05-18 09:46:46 -07:00
|
|
|
| Unbound_value of Longident.t
|
|
|
|
| Unbound_constructor of Longident.t
|
|
|
|
| Unbound_label of Longident.t
|
|
|
|
| Unbound_module of Longident.t
|
|
|
|
| Unbound_class of Longident.t
|
2010-05-18 10:18:24 -07:00
|
|
|
| Unbound_modtype of Longident.t
|
2010-05-18 10:25:02 -07:00
|
|
|
| Unbound_cltype of Longident.t
|
2010-05-18 09:46:46 -07:00
|
|
|
| Ill_typed_functor_application of Longident.t
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
exception Error of Location.t * error
|
|
|
|
|
2000-03-06 14:12:09 -08:00
|
|
|
val report_error: formatter -> error -> unit
|
2009-10-26 03:53:16 -07:00
|
|
|
|
|
|
|
(* Support for first-class modules. *)
|
|
|
|
val transl_modtype_longident: (Location.t -> Env.t -> Longident.t -> Path.t) ref (* from Typemod *)
|
|
|
|
val transl_modtype: (Env.t -> Parsetree.module_type -> Types.module_type) ref (* from Typemod *)
|
|
|
|
val create_package_mty: Location.t -> Env.t -> Parsetree.package_type -> (string * Parsetree.core_type) list * Parsetree.module_type
|
2010-05-18 09:46:46 -07:00
|
|
|
|
|
|
|
val find_type: Env.t -> Location.t -> Longident.t -> Path.t * Types.type_declaration
|
|
|
|
val find_constructor: Env.t -> Location.t -> Longident.t -> Types.constructor_description
|
|
|
|
val find_label: Env.t -> Location.t -> Longident.t -> Types.label_description
|
|
|
|
val find_value: Env.t -> Location.t -> Longident.t -> Path.t * Types.value_description
|
|
|
|
val find_class: Env.t -> Location.t -> Longident.t -> Path.t * Types.class_declaration
|
2010-05-18 10:14:31 -07:00
|
|
|
val find_module: Env.t -> Location.t -> Longident.t -> Path.t * Types.module_type
|
2010-05-18 10:18:24 -07:00
|
|
|
val find_modtype: Env.t -> Location.t -> Longident.t -> Path.t * Types.modtype_declaration
|
2010-05-18 10:25:02 -07:00
|
|
|
val find_cltype: Env.t -> Location.t -> Longident.t -> Path.t * Types.cltype_declaration
|