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

module F (X : sig type t = private < foo:int; ..> val x : t end) = struct
  let x : < foo: int; ..> = X.x
end;;
[%%expect{|
module F :
  functor (X : sig type t = private < foo : int; .. > val x : t end) ->
    sig val x : X.t end
|}]

module M = struct
  type t = < foo: int; bar: int>
  let x = object
    method foo = 0
    method bar = 0
  end
end;;
[%%expect{|
module M :
  sig type t = < bar : int; foo : int > val x : < bar : int; foo : int > end
|}]

module N = F(M);;
[%%expect{|
module N : sig val x : M.t end
|}]

module A : sig end = struct
  module F (X : sig type t = private < foo:int; ..> val x : t end) = struct
    let x : < foo: int; ..> = X.x
  end

  module N = F(M)
  let _ = (N.x = M.x)
end;;
[%%expect{|
module A : sig end
|}]