@@ -166,7 +166,7 @@ Line 1, characters 28-44:
166
166
1 | let f (x : bool ) = (x : int )[@ error_message]
167
167
^^^^^^^^^^^^^^^^
168
168
Warning 47 [attribute- payload]: illegal payload for attribute 'error_message'.
169
- Error_message attribute expects a string argument
169
+ error_message attribute expects a string argument
170
170
Line 1 , characters 20-21 :
171
171
1 | let f (x : bool ) = (x : int )[@ error_message]
172
172
^
@@ -177,16 +177,12 @@ Error: This expression has type bool but an expression was expected of type
177
177
(* Can only be applied once *)
178
178
let f (x : bool ) = (x : int )[@ error_message " A" ][@ error_message " B" ]
179
179
[%% expect{|
180
- Line 1 , characters 48-68 :
181
- 1 | let f (x : bool ) = (x : int )[@ error_message " A" ][@ error_message " B" ]
182
- ^^^^^^^^^^^^^^^^^^^^
183
- Warning 47 [attribute- payload]: illegal payload for attribute 'error_message'.
184
- More than one error_message attribute present. All of them will be ignored.
185
180
Line 1 , characters 20-21 :
186
181
1 | let f (x : bool ) = (x : int )[@ error_message " A" ][@ error_message " B" ]
187
182
^
188
183
Error : This expression has type bool but an expression was expected of type
189
184
int
185
+ A
190
186
| }]
191
187
192
188
(* Simple test case *)
@@ -197,7 +193,7 @@ Line 1, characters 20-21:
197
193
^
198
194
Error : This expression has type bool but an expression was expected of type
199
195
int
200
- because [ @ error_message]: custom message
196
+ custom message
201
197
| }]
202
198
203
199
(* Doesn't work when the type mismatch happens later. This differ from
@@ -231,7 +227,7 @@ Line 1, characters 22-23:
231
227
^
232
228
Error : This expression has type string but an expression was expected of type
233
229
('a : immediate )
234
- because [ @ error_message]: custom message
230
+ custom message
235
231
The layout of string is value, because
236
232
it is the primitive value type string .
237
233
But the layout of string must be a sublayout of immediate, because
@@ -254,7 +250,8 @@ Line 1, characters 12-29:
254
250
1 | let f () = (fun (x : int ) -> x : string )[@ error_message " custom message" ]
255
251
^^^^^^^^^^^^^^^^^
256
252
Error : This expression should not be a function , the expected type is
257
- string because [@ error_message]: custom message
253
+ string
254
+ custom message
258
255
|}]
259
256
260
257
(* Same when the function is not declared inline *)
@@ -279,5 +276,5 @@ Line 2, characters 12-13:
279
276
^
280
277
Error : This expression has type int -> int
281
278
but an expression was expected of type string
282
- because [ @ error_message]: custom message
279
+ custom message
283
280
| }]
0 commit comments