summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-private/private.compilers.reference
blob: 0ceefce6ed3fbaa2921a9d436da4699febe35600 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module Foobar : sig type t = private int end
module F0 : sig type t = private int end
Line 2, characters 20-21:
2 | let f (x : F0.t) = (x : Foobar.t);; (* fails *)
                        ^
Error: This expression has type F0.t but an expression was expected of type
         Foobar.t
module F = Foobar
val f : F.t -> Foobar.t = <fun>
module M : sig type t = < m : int > end
module M1 : sig type t = private < m : int; .. > end
module M2 : sig type t = private < m : int; .. > end
Line 1, characters 19-20:
1 | fun (x : M1.t) -> (x : M2.t);; (* fails *)
                       ^
Error: This expression has type M1.t but an expression was expected of type
         M2.t
module M3 : sig type t = private M1.t end
- : M3.t -> M1.t = <fun>
- : M3.t -> M.t = <fun>
Line 1, characters 44-46:
1 | module M4 : sig type t = private M3.t end = M2;; (* fails *)
                                                ^^
Error: Signature mismatch:
       Modules do not match:
         sig type t = M2.t end
       is not included in
         sig type t = private M3.t end
       Type declarations do not match:
         type t = M2.t
       is not included in
         type t = private M3.t
       The type M2.t is not equal to the type M3.t
Line 1, characters 44-45:
1 | module M4 : sig type t = private M3.t end = M;; (* fails *)
                                                ^
Error: Signature mismatch:
       Modules do not match:
         sig type t = < m : int > end
       is not included in
         sig type t = private M3.t end
       Type declarations do not match:
         type t = < m : int >
       is not included in
         type t = private M3.t
       The type < m : int > is not equal to the type M3.t
Line 1, characters 44-46:
1 | module M4 : sig type t = private M3.t end = M1;; (* might be ok *)
                                                ^^
Error: Signature mismatch:
       Modules do not match:
         sig type t = M1.t end
       is not included in
         sig type t = private M3.t end
       Type declarations do not match:
         type t = M1.t
       is not included in
         type t = private M3.t
       The type M1.t is not equal to the type M3.t
module M5 : sig type t = private M1.t end
Line 1, characters 53-55:
1 | module M6 : sig type t = private < n:int; .. > end = M1;; (* fails *)
                                                         ^^
Error: Signature mismatch:
       Modules do not match:
         sig type t = M1.t end
       is not included in
         sig type t = private < n : int; .. > end
       Type declarations do not match:
         type t = M1.t
       is not included in
         type t = private < n : int; .. >
       The implementation is missing the method n
Line 3, characters 2-51:
3 |   struct type t = int let f (x : int) = (x : t) end;; (* must fail *)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:
         sig type t = int val f : int -> t end
       is not included in
         sig type t = private Foobar.t val f : int -> t end
       Type declarations do not match:
         type t = int
       is not included in
         type t = private Foobar.t
       The type int is not equal to the type Foobar.t
module M : sig type t = private T of int val mk : int -> t end
module M1 : sig type t = M.t val mk : int -> t end
module M2 : sig type t = M.t val mk : int -> t end
module M3 : sig type t = M.t val mk : int -> t end
Line 3, characters 4-27:
3 |     type t = M.t = T of int
        ^^^^^^^^^^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type M.t
       Private variant constructor(s) would be revealed.
module M5 : sig type t = M.t = private T of int val mk : int -> t end
module M6 : sig type t = private T of int val mk : int -> t end
module M' :
  sig type t_priv = private T of int type t = t_priv val mk : int -> t end
module M3' : sig type t = M'.t val mk : int -> t end
module M : sig type 'a t = private T of 'a end
module M1 : sig type 'a t = 'a M.t = private T of 'a end
module Test : sig type t = private A end
module Test2 : sig type t = Test.t = private A end
val f : Test.t -> Test2.t = <fun>
val f : Test2.t -> unit = <fun>
Line 1, characters 8-15:
1 | let a = Test2.A;; (* fail *)
            ^^^^^^^
Error: Cannot create values of the private type Test2.t
Line 3, characters 40-63:
3 | module Test2 : module type of Test with type t = private Test.t = Test;;
                                            ^^^^^^^^^^^^^^^^^^^^^^^
Alert deprecated: spurious use of private

module Test2 : sig type t = Test.t = private A end
type t = private < x : int; .. >
type t = private < x : int; .. >
type t = private < x : int >
type t = private < x : int >
Line 1:
Error: Type declarations do not match:
         type !'a t = private < x : int; .. > constraint 'a = 'a t
       is not included in
         type 'a t
       Their parameters differ
       The type 'b t as 'b is not equal to the type 'a
type 'a t = private 'a constraint 'a = < x : int; .. >
type t = [ `Closed ]
type nonrec t = private [> t ]