summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-gadts/pr7234.ml
blob: 622aef9066b620cbb2593a69cf64552c93068f67 (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
type (_, _) eq = Eq : ('a, 'a) eq | Neq : int -> ('a, 'b) eq;;
type 'a t;;
let f (type a) (Neq n : (a, a t) eq) = n;;   (* warn! *)
[%%expect{|
type (_, _) eq = Eq : ('a, 'a) eq | Neq : int -> ('a, 'b) eq
type 'a t
Line _, characters 15-40:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
Eq
val f : ('a, 'a t) eq -> int = <fun>
|}];;

module F (T : sig type _ t end) = struct
 let f (type a) (Neq n : (a, a T.t) eq) = n  (* warn! *)
end;;
[%%expect{|
Line _, characters 16-43:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
Eq
module F :
  functor (T : sig type _ t end) -> sig val f : ('a, 'a T.t) eq -> int end
|}];;