summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/typing-implicit_unpack/implicit_unpack.ml.reference
blob: 32c49a296120cefa9f476551a21871ebbbb0ae69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

# * * * * * * * * *                               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>
#