summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-recmod/pr9494.ml
blob: 41fda6aa158e88df815bd26bdef6fd665b0ac993 (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
*)

(* PR#9494 *)

(* Additional test cases from Vincent Laviron: *)

(* Looping version *)
module rec M1 : sig
  val f : unit -> unit
  val g : unit -> unit
end = struct
  let f = M1.g
  let g () = M1.f ()
end

(* Alias chain *)
module rec M2 : sig
  val f : unit -> unit
  val g : unit -> unit
end = struct
  let f = M2.g
  let g = M2.f
end

(* Original test case from the issue: *)

module rec Id : sig
  type t = {id : int}
  val compare : t -> t -> int
end = Id (* error here: undefined compare function *)

module IdSet = Set.Make(Id)

let _ = try
  let basic_set = IdSet.singleton {id = 0} in
  IdSet.mem {id = 1} basic_set (* diverge here *)
with e -> print_endline @@ Printexc.to_string e; false