summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-misc/gpr2277.ml
blob: 3d2b8b8d2709375e2c50bff931e6e9355ac10825 (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
52
53
54
(* TEST
 expect;
*)

let f (type t) (x : t) = x

[%%expect {|
val f : 't -> 't = <fun>
|}]

let g (type t') (x : t') = x

let g' (x : ' t') = x

[%%expect {|
val g : ' t' -> ' t' = <fun>
val g' : ' t' -> ' t' = <fun>
|}]

let h (type a'bc) (x : a'bc) = x

let h' (x : ' a'bc) = x

[%%expect {|
val h : ' a'bc -> ' a'bc = <fun>
val h' : ' a'bc -> ' a'bc = <fun>
|}]

let i (type fst snd) (x : fst) (y : snd) = (x, y)

[%%expect {|
val i : 'fst -> 'snd -> 'fst * 'snd = <fun>
|}]

let j (type fst snd fst' snd') (x : fst) (y : snd) (a : fst') (b : snd') =
  ((x, y), (a, b))

[%%expect {|
val j : 'fst -> 'snd -> 'fst' -> 'snd' -> ('fst * 'snd) * ('fst' * 'snd') =
  <fun>
|}]

(* Variable names starting with _ are reserved for the compiler. *)
let k (type _weak1) (x : _weak1) = x

[%%expect {|
val k : 'a -> 'a = <fun>
|}]

let l (type _') (x : _') = x

[%%expect {|
val l : 'a -> 'a = <fun>
|}]