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

(* PR#6650 *)

module type S = sig
  class type c = object method m : int end
  module M : sig
    class type d = c
  end
end;;
module F (X : S) = X.M;;
[%%expect{|
module type S =
  sig
    class type c = object method m : int end
    module M : sig class type d = c end
  end
module F : functor (X : S) -> sig class type d = X.c end
|}];;

(* PR#6648 *)

module M = struct module N = struct let x = 1 end end;;
#show_module M;;
[%%expect{|
module M : sig module N : sig val x : int end end
module M : sig module N : sig ... end end
|}];;

(* Shortcut notation for functors *)
module type A
module type B
module type C
module type D
module type E
module type F
module Test(X: ((A->(B->C)->D) -> (E -> F))) = struct end
[%%expect {|
module type A
module type B
module type C
module type D
module type E
module type F
module Test : functor (X : (A -> (B -> C) -> D) -> E -> F) -> sig end
|}]

(* test reprinting of functors *)
module type LongFunctor1 = functor (X : A) () (_ : B) () -> C -> D -> sig end
[%%expect {|
module type LongFunctor1 = functor (X : A) () (_ : B) () -> C -> D -> sig end
|}]
module type LongFunctor2 = functor (_ : A) () (_ : B) () -> C -> D -> sig end
[%%expect {|
module type LongFunctor2 = A -> functor () (_ : B) () -> C -> D -> sig end
|}]