summaryrefslogtreecommitdiff
path: root/testsuite/tests/generalized-open/funct_body.ml
blob: d20f4d2c537cdbb2de3d6365694aa3a661444afb (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
55
56
57
(* TEST_BELOW
(* Blank lines added here to preserve locations. *)



*)

module type T = sig
  type t
  val x : t
  val f : t -> unit
end

module Int = struct
  type t = int
  let x = 42
  let f = print_int
end

module String = struct
  type t = string
  let x = "Forty Two"
  let f = print_endline
end

let r = ref (module Int : T)

module F (X : sig end) = struct
  open struct
    include (val !r)
  end
  type s = t
  let x : s = x
  let f : s -> unit = f
end

module M = struct end

module N = F(M)

let () =
  r := (module String : T)

module O = F(M)

let () =
  O.f N.x

(* TEST
 setup-ocamlc.byte-build-env;
 {
   ocamlc_byte_exit_status = "2";
   ocamlc.byte;
 }{
   check-ocamlc.byte-output;
 }
*)