summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-modules/pr7787.ml
blob: ccb32cfd8db55422b18e4e59cda5cb6609ca00c6 (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
(* TEST
 expect;
*)

module O (T : sig
    module N : sig
      val foo : int -> int
    end
  end) = struct
  open T

  let go () =
    N.foo 42 (* finding N (from T) goes wrong *)
end

module T = struct
  module N = struct
    let foo x = x + 3
  end
end;;
[%%expect{|
module O :
  functor (T : sig module N : sig val foo : int -> int end end) ->
    sig val go : unit -> int end
module T : sig module N : sig val foo : int -> int end end
|}]

(* Incidentally, M isn't used in T2, but it doesn't seem to fail if
   it's just "module M" and "module T2" separately *)
module rec M : sig
  val go : unit -> int
end = O (T2)
and T2 : sig
  include module type of struct include T end
end = struct
  include T
end;;
[%%expect{|
module rec M : sig val go : unit -> int end
and T2 : sig module N = T.N end
|}]

let () = ignore (M.go ())
[%%expect{|
|}]