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

module M = struct
  type _ rr = Soa : int rr
  type b = B : 'a rr * 'a -> b
end

let test =
  let M.(B (k, v)) = M.(B (Soa, 0)) in
  match k, v with
  | M.Soa, soa -> (soa : int)
[%%expect{|
module M : sig type _ rr = Soa : int rr type b = B : 'a rr * 'a -> b end
val test : int = 0
|}]

let test =
  let open M in
  let B (k, v) = B (Soa, 0) in
  match k, v with
  | Soa, soa -> (soa : int)
[%%expect{|
val test : int = 0
|}]

type _ ty = Int : int ty
type dyn = Dyn : 'a ty * 'a -> dyn
[%%expect{|
type _ ty = Int : int ty
type dyn = Dyn : 'a ty * 'a -> dyn
|}]

let f String.(Dyn (type a) (w, x : a ty * a)) = ignore (x : a)
[%%expect{|
val f : dyn -> unit = <fun>
|}]