blob: c7975600df35f3ce9a69a9cbfc0f8bdf092d1a2d (
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
|
(* TEST
expect;
*)
type (_, _) t =
A : ('a, 'a) t
| B : string -> ('a, 'b) t
;;
module M (A : sig module type T end) (B : sig module type T end) =
struct
let f : ((module A.T), (module B.T)) t -> string = function
| B s -> s
end;;
module A = struct module type T = sig end end;;
module N = M(A)(A);;
let x = N.f A;;
[%%expect{|
type (_, _) t = A : ('a, 'a) t | B : string -> ('a, 'b) t
Lines 8-9, characters 52-13:
8 | ....................................................function
9 | | B s -> s
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
A
module M :
functor (A : sig module type T end) (B : sig module type T end) ->
sig val f : ((module A.T), (module B.T)) t -> string end
module A : sig module type T = sig end end
module N : sig val f : ((module A.T), (module A.T)) t -> string end
Exception: Match_failure ("", 8, 52).
|}];;
|