@@ -67,7 +67,6 @@ can't be erased for compatibility with upstream OCaml.
67
67
module type S = sig type _ g = MkG : ('a : immediate ). 'a g end
68
68
| }];;
69
69
70
- (* CR layouts: only show the warning once; same for tests below *)
71
70
let f (type a : immediate ): a -> a = fun x -> x
72
71
[%% expect {|
73
72
Line 1 , characters 4-5 :
@@ -76,12 +75,6 @@ Line 1, characters 4-5:
76
75
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
77
76
can't be erased for compatibility with upstream OCaml.
78
77
79
- Line 1 , characters 6-47 :
80
- 1 | let f (type a : immediate ): a -> a = fun x -> x
81
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
83
- can't be erased for compatibility with upstream OCaml.
84
-
85
78
val f : ('a : immediate ). 'a -> 'a = < fun>
86
79
|}];;
87
80
@@ -93,12 +86,6 @@ Line 1, characters 4-5:
93
86
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
94
87
can't be erased for compatibility with upstream OCaml.
95
88
96
- Line 1 , characters 6-31 :
97
- 1 | let f x = (x : (_ : immediate ))
98
- ^^^^^^^^^^^^^^^^^^^^^^^^^
99
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
100
- can't be erased for compatibility with upstream OCaml.
101
-
102
89
val f : ('a : immediate ). 'a -> 'a = < fun>
103
90
|}];;
104
91
@@ -110,12 +97,6 @@ Line 1, characters 4-5:
110
97
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
111
98
can't be erased for compatibility with upstream OCaml.
112
99
113
- Line 1 , characters 6-63 :
114
- 1 | let f v : ((_ : immediate)[@error_message "Custom message"]) = v
115
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
117
- can't be erased for compatibility with upstream OCaml.
118
-
119
100
val f : ('a : immediate ). 'a -> 'a = < fun>
120
101
|}];;
121
102
@@ -182,12 +163,6 @@ Line 1, characters 4-5:
182
163
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
183
164
can't be erased for compatibility with upstream OCaml.
184
165
185
- Line 1 , characters 6-49 :
186
- 1 | let f (type a : immediate64 ): a -> a = fun x -> x
187
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
189
- can't be erased for compatibility with upstream OCaml.
190
-
191
166
val f : ('a : immediate64 ). 'a -> 'a = < fun>
192
167
|}];;
193
168
@@ -199,12 +174,6 @@ Line 1, characters 4-5:
199
174
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
200
175
can't be erased for compatibility with upstream OCaml.
201
176
202
- Line 1 , characters 6-33 :
203
- 1 | let f x = (x : (_ : immediate64 ))
204
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^
205
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
206
- can't be erased for compatibility with upstream OCaml.
207
-
208
177
val f : ('a : immediate64 ). 'a -> 'a = < fun>
209
178
|}];;
210
179
@@ -216,12 +185,6 @@ Line 1, characters 4-5:
216
185
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
217
186
can't be erased for compatibility with upstream OCaml.
218
187
219
- Line 1 , characters 6-65 :
220
- 1 | let f v : ((_ : immediate64)[@error_message "Custom message"]) = v
221
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
223
- can't be erased for compatibility with upstream OCaml.
224
-
225
188
val f : ('a : immediate64 ). 'a -> 'a = < fun>
226
189
|}];;
227
190
@@ -289,15 +252,13 @@ Line 5, characters 4-5:
289
252
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
290
253
can't be erased for compatibility with upstream OCaml.
291
254
292
- Line 5 , characters 6-50 :
293
- 5 | let f (module _ : S with type t = 'a ) (x : 'a ) = x
294
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
295
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in f
296
- can't be erased for compatibility with upstream OCaml.
297
-
298
255
val f : ('a : immediate ). (module S with type t = 'a ) -> 'a -> 'a = < fun>
299
256
|}]
300
257
258
+ (* CR layouts: this example should raise a warning, but it does not.
259
+ It's quite complicated, and missing it only means that this error
260
+ will be caught by the upstream compiler later. We have decided that
261
+ fixing this is not worth the effort. *)
301
262
module type S = sig
302
263
type t [@@immediate]
303
264
end
@@ -312,7 +273,10 @@ module type S = sig type t : immediate end
312
273
val x : int = 15
313
274
|}]
314
275
315
- (* CR layouts: this should raise a warning *)
276
+ (* CR layouts: this example should raise a warning, but it does not.
277
+ It's quite complicated, and missing it only means that this error
278
+ will be caught by the upstream compiler later. We have decided that
279
+ fixing this is not worth the effort. *)
316
280
let y =
317
281
ignore (fun (type a : immediate ) (x : a ) ->
318
282
let module _ : S = struct
@@ -580,12 +544,6 @@ Line 1, characters 21-26:
580
544
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in fails
581
545
can't be erased for compatibility with upstream OCaml.
582
546
583
- Line 1 , characters 27-68 :
584
- 1 | let [@ warning " -187" ] fails (type a : immediate ): a -> a = fun x -> x
585
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
586
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in fails
587
- can't be erased for compatibility with upstream OCaml.
588
-
589
547
val fails : ('a : immediate ). 'a -> 'a = < fun>
590
548
|}]
591
549
@@ -603,9 +561,7 @@ can't be erased for compatibility with upstream OCaml.
603
561
module type S1 = sig type ('a : immediate ) fails = int end
604
562
| }]
605
563
606
- (* Disabling the warning just in the signature isn't sufficient.
607
-
608
- The check here is also ran twice for some reason. *)
564
+ (* Disabling the warning just in the signature isn't sufficient. *)
609
565
module M6 : sig
610
566
[@@@ warning " -187" ]
611
567
type ('a : immediate) t = 'a * 'a
@@ -619,12 +575,6 @@ Line 5, characters 2-35:
619
575
Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in t
620
576
can't be erased for compatibility with upstream OCaml.
621
577
622
- Line 5 , characters 2-35 :
623
- 5 | type ('a : immediate ) t = 'a * 'a
624
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
625
- Warning 187 [incompatible- with - upstream]: Usage of layout immediate/ immediate64 in t
626
- can't be erased for compatibility with upstream OCaml.
627
-
628
578
module M6 : sig type ('a : immediate ) t = 'a * 'a end
629
579
| }]
630
580
0 commit comments