summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-modules-bugs/pr10693_bad.ml
blob: 4e964c9e13bc777a9eb644e07b53fdf142bccfa4 (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
(* TEST
flags = "-no-app-funct"
ocamlc_byte_exit_status = "2"
* setup-ocamlc.byte-build-env
** ocamlc.byte
*** check-ocamlc.byte-output
*)
module type Dep = sig type t val x : t end
module String = struct type t = string let x = "Forty Two" end
module Int = struct type t = int let x = 42 end

module type S = sig
  val x : 'a option
  module M : functor (X : Dep) -> sig
    val x : X.t option
    module M : functor (Y : Dep) -> sig
      val x : X.t option
    end
  end
end

module type S' = sig
  val x : 'a option
  module M : functor (_ : Dep) -> S
end

module Bad (A : S') : S = A

module M = struct
  let x = None
  module M (_ : Dep) = struct
    let x = None
    module M (X : Dep) = struct
      let x = Some X.x
      module M (Y : Dep) = struct
        let x = Some X.x
      end
    end
  end
end

module N = Bad(M)
module N' = N.M(String)
module N'' = N'.M(Int)

let () = print_endline (Option.get N''.x)