Skip to content

Commit e2e0e7e

Browse files
committed
add tests with layout_poly
1 parent 112f995 commit e2e0e7e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ocaml/testsuite/tests/typing-layouts/erasable_annot.ml

+27
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,30 @@ Line 1, characters 26-32:
316316
^^^^^^
317317
Error: Don't know how to untag this type. Only int can be untagged.
318318
|}];;
319+
320+
(* With [@layout_poly] *)
321+
322+
external[@layout_poly] id : ('a : any). 'a -> 'a = "%identity"
323+
[%%expect{|
324+
external id : ('a : any). 'a -> 'a = "%identity" [@@layout_poly]
325+
|}];;
326+
327+
328+
external[@layout_poly] id : ('a : any). 'a -> 'a = "%identity" [@@unboxed]
329+
[%%expect{|
330+
Line 1, characters 40-42:
331+
1 | external[@layout_poly] id : ('a : any). 'a -> 'a = "%identity" [@@unboxed]
332+
^^
333+
Error: Don't know how to unbox this type.
334+
Only float, int32, int64, nativeint, and vector primitives can be unboxed.
335+
|}];;
336+
337+
338+
external[@layout_poly] id : ('a : any). ('a[@unboxed]) -> 'a = "%identity"
339+
[%%expect{|
340+
Line 1, characters 41-43:
341+
1 | external[@layout_poly] id : ('a : any). ('a[@unboxed]) -> 'a = "%identity"
342+
^^
343+
Error: Don't know how to unbox this type.
344+
Only float, int32, int64, nativeint, and vector primitives can be unboxed.
345+
|}];;

0 commit comments

Comments
 (0)