forked from ocamllabs/ocaml
/
test_stdlabels.ml
47 lines (41 loc) · 1.43 KB
/
test_stdlabels.ml
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
(* TEST
flags += " -nolabels "
*)
module A : module type of Array = ArrayLabels
module B : module type of Bytes = BytesLabels
module L : module type of List = ListLabels
module S : module type of String = StringLabels
module M : module type of struct include Map end [@remove_aliases] =
MoreLabels.Map
module Se : module type of struct include Set end [@remove_aliases] =
MoreLabels.Set
(* For *)
(* module H : module type of Hashtbl = MoreLabels.Hashtbl *)
(* we will have following error: *)
(* Error: Signature mismatch: *)
(* ... *)
(* Type declarations do not match: *)
(* type statistics = Hashtbl.statistics *)
(* is not included in *)
(* type statistics = { *)
(* num_bindings : int; *)
(* num_buckets : int; *)
(* max_bucket_length : int; *)
(* bucket_histogram : int array; *)
(* } *)
(* Their kinds differ. *)
(* This is workaround:*)
module Indirection = struct
type t = Hashtbl.statistics = { num_bindings: int;
num_buckets: int;
max_bucket_length: int;
bucket_histogram: int array}
end
module type HS = sig
type statistics = Indirection.t
include module type of struct include Hashtbl end [@remove_aliases]
with type statistics := Indirection.t
end
module H : HS = MoreLabels.Hashtbl
let () =
()