Source

mutated_ocaml / testsuite / tests / typing-implicit_unpack / implicit_unpack.ml.reference


# * * * * * * * * *                               val sort : (module Set.S with type elt = 'a) -> 'a list -> 'a list = <fun>
val make_set : ('a -> 'a -> int) -> (module Set.S with type elt = 'a) = <fun>
val sort_cmp : ('a -> 'a -> int) -> 'a list -> 'a list = <fun>
module type S = sig type t val x : t end
# val f : (module S with type t = int) -> int = <fun>
# Characters 6-37:
  let f (module M : S with type t = 'a) = M.x;; (* Error *)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The type of this packed module contains variables:
(module S with type t = 'a)
# val f : (module S with type t = 'a) -> 'a = <fun>
# - : int = 1
#   type 'a s = { s : (module S with type t = 'a); }
# - : int s = {s = <module>}
# Characters 9-19:
  let f {s=(module M)} = M.x;; (* Error *)
           ^^^^^^^^^^
Error: The type of this packed module contains variables:
(module S with type t = 'a)
# val f : 'a s -> 'a = <fun>
#   type s = { s : (module S with type t = int); }
# val f : s -> int = <fun>
# val f : s -> s -> int = <fun>
#   module type S = sig val x : int end
# val f : (module S) -> int -> (module S) -> int = <fun>
# Characters 8-37:
  let m = (module struct let x = 3 end);; (* Error *)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The signature for this packaged module couldn't be inferred.
# val m : (module S) = <module>
# - : int = 7
# - : int = 6
#   - : int = 3
# Characters 4-14:
  let (module M) = m;; (* Error: only allowed in [let .. in] *)
      ^^^^^^^^^^
Error: Modules are not allowed in this pattern.
# Characters 14-24:
  class c = let (module M) = m in object end;; (* Error again *)
                ^^^^^^^^^^
Error: Modules are not allowed in this pattern.
# module M : S
#   module type S' = sig val f : int -> int end
#       - : int = 6
#                                                                                                                                                                                   module type S = sig type t type u val x : t * u end
val f :
  (module S with type t = int and type u = bool) list ->
  (module S with type u = bool) list = <fun>
module TypEq :
  sig
    type ('a, 'b) t
    val apply : ('a, 'b) t -> 'a -> 'b
    val refl : ('a, 'a) t
    val sym : ('a, 'b) t -> ('b, 'a) t
  end
module rec Typ :
  sig
    module type PAIR =
      sig
        type t
        and t1
        and t2
        val eq : (t, t1 * t2) TypEq.t
        val t1 : t1 Typ.typ
        val t2 : t2 Typ.typ
      end
    type 'a typ =
        Int of ('a, int) TypEq.t
      | String of ('a, string) TypEq.t
      | Pair of (module PAIR with type t = 'a)
  end
val int : int Typ.typ = Int <abstr>
val str : string Typ.typ = String <abstr>
val pair : 'a Typ.typ -> 'b Typ.typ -> ('a * 'b) Typ.typ = <fun>
val to_string : 'a Typ.typ -> 'a -> string = <fun>
module type MapT =
  sig
    type key
    type +'a t
    val empty : 'a t
    val is_empty : 'a t -> bool
    val mem : key -> 'a t -> bool
    val add : key -> 'a -> 'a t -> 'a t
    val singleton : key -> 'a -> 'a t
    val remove : key -> 'a t -> 'a t
    val merge :
      (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
    val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    val for_all : (key -> 'a -> bool) -> 'a t -> bool
    val exists : (key -> 'a -> bool) -> 'a t -> bool
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
    val cardinal : 'a t -> int
    val bindings : 'a t -> (key * 'a) list
    val min_binding : 'a t -> key * 'a
    val max_binding : 'a t -> key * 'a
    val choose : 'a t -> key * 'a
    val split : key -> 'a t -> 'a t * 'a option * 'a t
    val find : key -> 'a t -> 'a
    val map : ('a -> 'b) -> 'a t -> 'b t
    val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
    type data
    type map
    val of_t : data t -> map
    val to_t : map -> data t
  end
type ('k, 'd, 'm) map =
    (module MapT with type data = 'd and type key = 'k and type map = 'm)
val add : ('a, 'b, 'c) map -> 'a -> 'b -> 'c -> 'c = <fun>
module SSMap :
  sig
    type key = String.t
    type 'a t = 'a Map.Make(String).t
    val empty : 'a t
    val is_empty : 'a t -> bool
    val mem : key -> 'a t -> bool
    val add : key -> 'a -> 'a t -> 'a t
    val singleton : key -> 'a -> 'a t
    val remove : key -> 'a t -> 'a t
    val merge :
      (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
    val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    val for_all : (key -> 'a -> bool) -> 'a t -> bool
    val exists : (key -> 'a -> bool) -> 'a t -> bool
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
    val cardinal : 'a t -> int
    val bindings : 'a t -> (key * 'a) list
    val min_binding : 'a t -> key * 'a
    val max_binding : 'a t -> key * 'a
    val choose : 'a t -> key * 'a
    val split : key -> 'a t -> 'a t * 'a option * 'a t
    val find : key -> 'a t -> 'a
    val map : ('a -> 'b) -> 'a t -> 'b t
    val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
    type data = string
    type map = data t
    val of_t : 'a -> 'a
    val to_t : 'a -> 'a
  end
val ssmap :
  (module MapT with type data = string and type key = string and type map = 
   SSMap.map) =
  <module>
#         val ssmap :
  (module MapT with type data = string and type key = string and type map = 
   SSMap.map) =
  <module>
#           val ssmap :
  (module MapT with type data = string and type key = string and type map = 
   SSMap.map) =
  <module>
#       val ssmap :
  (module MapT with type data = SSMap.data and type key = SSMap.key and type map = 
   SSMap.map) =
  <module>
#   val ssmap : (SSMap.key, SSMap.data, SSMap.map) map = <module>
#   - : SSMap.key -> SSMap.data -> SSMap.map -> SSMap.map = <fun>
#