File tree Expand file tree Collapse file tree 1 file changed +67
-0
lines changed
ocaml/testsuite/tests/typing-modules Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -101,3 +101,70 @@ module Unaliasable :
101
101
module X : (A. S with A. M [@ unaliasable])
102
102
end
103
103
| }]
104
+
105
+ module Subtype = struct
106
+ module type S
107
+ module F (G :functor (X :S ) -> S )(X :S )(Y :S with X ) = G (Y )
108
+ end
109
+ [%% expect{|
110
+ module Subtype :
111
+ sig
112
+ module type S
113
+ module F :
114
+ functor (G : functor (X : S ) -> S ) (X : S ) (Y : (S with X )) ->
115
+ (S with G (Y ))
116
+ end
117
+ | }]
118
+
119
+ module Can_use_type = struct
120
+ module type S = sig type t end
121
+ module A : sig
122
+ module M : S
123
+ module N : S with M
124
+ val foo : M .t -> M .t
125
+ val bar : N .t
126
+ end = struct
127
+ module M = struct type t = int end
128
+ module N = M
129
+ let foo x = x
130
+ let bar = 0
131
+ end
132
+
133
+ let x = A .foo A .bar
134
+ end
135
+ [%% expect{|
136
+ module Can_use_type :
137
+ sig
138
+ module type S = sig type t end
139
+ module A :
140
+ sig
141
+ module M : S
142
+ module N : sig type t = M. t end
143
+ val foo : M .t -> M .t
144
+ val bar : N .t
145
+ end
146
+ val x : A .M .t
147
+ end
148
+ | }]
149
+
150
+ module Ignore_strengthening = struct
151
+ module type S = sig type t = int end
152
+ module A : sig
153
+ module M : S
154
+ module F (X : S with M ) : S
155
+ end = struct
156
+ module M = struct type t = int end
157
+ module F (X : S with M ) = X
158
+ end
159
+
160
+ module M = A .F (struct type t = int end )
161
+ end
162
+ [%% expect{|
163
+ module Ignore_strengthening :
164
+ sig
165
+ module type S = sig type t = int end
166
+ module A :
167
+ sig module M : S module F : functor (X : sig type t = int end ) -> S end
168
+ module M : S
169
+ end
170
+ | }]
You can’t perform that action at this time.
0 commit comments