blob: c286f154f25b175ebdc215e3984c70fa85b18d6b (
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
|
(* TEST
flags = " -w +A -strict-sequence "
* expect
*)
module TypEq = struct
type (_, _) t = Eq : ('a, 'a) t
end
module type T = sig
type _ is_t = Is : ('a, 'b) TypEq.t -> 'a is_t
val is_t : unit -> unit is_t option
end
module Make (M : T) =
struct
let _ =
match M.is_t () with
| None -> 0
| Some _ -> 0
let f () =
match M.is_t () with None -> 0
end;;
[%%expect {|
module TypEq : sig type (_, _) t = Eq : ('a, 'a) t end
module type T =
sig
type _ is_t = Is : ('a, 'b) TypEq.t -> 'a is_t
val is_t : unit -> unit is_t option
end
Line 17, characters 5-35:
17 | match M.is_t () with None -> 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
Some (Is Eq)
module Make : functor (M : T) -> sig val f : unit -> int end
|}]
module Make2 (M : T) = struct
type t = T of unit M.is_t
let g : t -> int = function _ -> .
end;;
[%%expect {|
Line 3, characters 30-31:
3 | let g : t -> int = function _ -> .
^
Error: This match case could not be refuted.
Here is an example of a value that would reach it: T (Is Eq)
|}]
|