summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-gadts/pr5785.ml
blob: 102ba05f4b567fc0f65d7deced9c23552bdd7987 (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
(* TEST
 expect;
*)

module Add (T : sig type two end) =
struct
  type _ t =
  | One : [`One] t
  | Two : T.two t

  let add (type a) : a t * a t -> string = function
    | One, One -> "two"
    | Two, Two -> "four"
end;;
[%%expect{|
Lines 7-9, characters 43-24:
7 | ...........................................function
8 |     | One, One -> "two"
9 |     | Two, Two -> "four"
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
(One, Two)

module Add :
  functor (T : sig type two end) ->
    sig
      type _ t = One : [ `One ] t | Two : T.two t
      val add : 'a t * 'a t -> string
    end
|}];;