@@ -98,3 +98,183 @@ Multiple signature items
98
98
File " test.ml" , line 1 , characters 0 -40:
99
99
Error: [] expected
100
100
[1 ]
101
+
102
+ Ptyp
103
+ $ cat > test. ml << EOF
104
+ > [%% import: string]
105
+ > EOF
106
+
107
+ $ dune build
108
+ File " test.ml" , line 1 , characters 0 -18:
109
+ 1 | [%% import: string]
110
+ ^^^^^^^^^^^^^^^^^^
111
+ Error: PSig expected
112
+ [1 ]
113
+
114
+ Inline module type declaration
115
+ $ cat > test. ml << EOF
116
+ > module type Hashable = [% import : (module sig type t end )]
117
+ > EOF
118
+
119
+ $ dune build
120
+ File " test.ml" , line 1 , characters 41 -55:
121
+ 1 | module type Hashable = [% import : (module sig type t end )]
122
+ ^^^^^^^^^^^^^^
123
+ Error: invalid package type : only module type identifier and ' with type' constraints are supported
124
+ [1 ]
125
+
126
+ Functor
127
+ $ cat > test. ml << EOF
128
+ > module type Foo = [% import : (module functor (M : sig end ) -> sig end )]
129
+ > EOF
130
+
131
+ $ dune build
132
+ File " test.ml" , line 1 , characters 44 -68:
133
+ 1 | module type Foo = [% import : (module functor (M : sig end ) -> sig end )]
134
+ ^^^^^^^^^^^^^^^^^^^^^^^^
135
+ Error: invalid package type : only module type identifier and ' with type' constraints are supported
136
+ [1 ]
137
+
138
+ Module type of
139
+ $ cat > test. ml << EOF
140
+ > module type Example = [% import : (module type of A)]
141
+ > EOF
142
+
143
+ $ dune build
144
+ File " test.ml" , line 1 , characters 40 -44:
145
+ 1 | module type Example = [% import : (module type of A)]
146
+ ^^^^
147
+ Error: Syntax error
148
+ [1 ]
149
+
150
+ Pmty_extension
151
+ $ cat > test. ml << EOF
152
+ > module type M = [% import : [% extension ]]
153
+ > EOF
154
+
155
+ $ dune build
156
+ File " test.ml" , line 1 , characters 26 -38:
157
+ 1 | module type M = [% import : [% extension ]]
158
+ ^^^^^^^^^^^^
159
+ Error: package expected
160
+ [1 ]
161
+
162
+ Pwith_module
163
+ $ cat > test. ml << EOF
164
+ > module type StringHashable = sig
165
+ > type t = string
166
+ > val equal : t -> t -> bool
167
+ > val hash : t -> int
168
+ > end
169
+ >
170
+ > module StringHashable = struct
171
+ > type t = string
172
+ > let equal = (= )
173
+ > let hash = Hashtbl. hash
174
+ > end
175
+ >
176
+ > module type HashableWith = [% import : (module sig
177
+ > include module type of StringHashable
178
+ > end with module StringHashable = StringHashable)]
179
+ > EOF
180
+
181
+ $ dune build
182
+ File " test.ml" , lines 13 -15, characters 45 -47:
183
+ 13 | ............................................. sig
184
+ 14 | include module type of StringHashable
185
+ 15 | end with module StringHashable = StringHashable..
186
+ Error: invalid package type : only module type identifier and ' with type' constraints are supported
187
+ [1 ]
188
+
189
+ Pwith_modtype
190
+ $ cat > test. ml << EOF
191
+ > module type StringHashable = sig
192
+ > type t = string
193
+ > val equal : t -> t -> bool
194
+ > val hash : t -> int
195
+ > end
196
+ >
197
+ > module StringHashable = struct
198
+ > type t = string
199
+ > let equal = (= )
200
+ > let hash = Hashtbl. hash
201
+ > end
202
+ >
203
+ > module type HashableWith = [% import : (module sig
204
+ > include module type of StringHashable
205
+ > end with module type StringHashable = StringHashable)]
206
+ > EOF
207
+
208
+ $ dune build
209
+ File " test.ml" , lines 13 -15, characters 45 -52:
210
+ 13 | ............................................. sig
211
+ 14 | include module type of StringHashable
212
+ 15 | end with module type StringHashable = StringHashable..
213
+ Error: invalid package type : only module type identifier and ' with type' constraints are supported
214
+ [1 ]
215
+
216
+ Pwith_typesubst
217
+ $ cat > test. ml << EOF
218
+ > module type HashableWith = [% import : (module Hashtbl . HashedType with type t := string)]
219
+ > EOF
220
+
221
+ $ dune build
222
+ File " test.ml" , line 1 , characters 45 -85:
223
+ 1 | module type HashableWith = [% import : (module Hashtbl . HashedType with type t := string)]
224
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
225
+ Error: invalid package type : only 'with type t = ' constraints are supported
226
+ [1]
227
+
228
+ Pwith_modtypesubst
229
+ $ cat >test.ml <<EOF
230
+ > module type StringHashable = sig
231
+ > type t = string
232
+ > val equal : t -> t -> bool
233
+ > val hash : t -> int
234
+ > end
235
+ >
236
+ > module StringHashable = struct
237
+ > type t = string
238
+ > let equal = (=)
239
+ > let hash = Hashtbl.hash
240
+ > end
241
+ >
242
+ > module type HashableWith = [%import: (module sig
243
+ > include module type of StringHashable
244
+ > end with module type StringHashable := StringHashable)]
245
+ > EOF
246
+
247
+ $ dune build
248
+ File "test.ml", lines 13-15, characters 45-53:
249
+ 13 | .............................................sig
250
+ 14 | include module type of StringHashable
251
+ 15 | end with module type StringHashable := StringHashable..
252
+ Error: invalid package type: only module type identifier and ' with type' constraints are supported
253
+ [1 ]
254
+
255
+ Pwith_modsubst
256
+ $ cat > test. ml << EOF
257
+ > module type StringHashable = sig
258
+ > type t = string
259
+ > val equal : t -> t -> bool
260
+ > val hash : t -> int
261
+ > end
262
+ >
263
+ > module StringHashable = struct
264
+ > type t = string
265
+ > let equal = (= )
266
+ > let hash = Hashtbl. hash
267
+ > end
268
+ >
269
+ > module type HashableWith = [% import : (module sig
270
+ > include module type of StringHashable
271
+ > end with module StringHashable := StringHashable)]
272
+ > EOF
273
+
274
+ $ dune build
275
+ File " test.ml" , lines 13 -15, characters 45 -48:
276
+ 13 | ............................................. sig
277
+ 14 | include module type of StringHashable
278
+ 15 | end with module StringHashable := StringHashable..
279
+ Error: invalid package type : only module type identifier and ' with type' constraints are supported
280
+ [1 ]
0 commit comments