summaryrefslogtreecommitdiff
path: root/testsuite/tests/tool-toplevel/topeval.ml
blob: 802f04b5afc8e48dcd740229bd2ece86981da1d3 (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
(* TEST
   * toplevel
   * toplevel.opt
*)

(* Various test-cases ensuring that the native and bytecode toplevels produce
   the same output *)

(* PR 10712 *)
module A : sig
  type ('foo, 'bar) t

  val get_foo : ('foo, _) t -> 'foo option
end = struct
  type ('foo, 'bar) t =
    | Foo of 'foo
    | Bar of 'bar

  let get_foo = function
    | Foo foo -> Some foo
    | Bar _ -> None
end
;;

(* Type variables should be 'foo and 'a (name persists) *)
A.get_foo
;;

(* Type variables be 'a and 'b (original names lost in let-binding) *)
let _bar = A.get_foo
;;

(* PR 10849 *)
let _ : int = 42
;;

let (_ : bool) : bool = false
;;

let List.(_) = ""
;;

let List.(String.(_)) = 'd'
;;

let List.(_) : float = 42.0
;;