summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-gadts/pr7234.ml
blob: 614f0adce10274527b02b5a50d3d080a1943f2fa (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
(* TEST
   * expect
*)

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 3, characters 15-40:
3 | let f (type a) (Neq n : (a, a t) eq) = n;;   (* warn! *)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8 [partial-match]: 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 2, characters 16-43:
2 |  let f (type a) (Neq n : (a, a T.t) eq) = n  (* warn! *)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8 [partial-match]: 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
|}];;