Skip to content

Commit

Permalink
Add a suggested test
Browse files Browse the repository at this point in the history
  • Loading branch information
ccasin committed Aug 23, 2024
1 parent aef2d4f commit 6d6c68f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ocaml/testsuite/tests/typing-modes/tuple_modes.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* TEST
flags = "-extension layouts_beta";
expect;
*)

Expand Down Expand Up @@ -104,3 +105,24 @@ Line 3, characters 42-44:
^^
Error: This value escapes its region.
|}]

(* An unboxed tuple is not an allocation, but a regular tuple is *)
let f_unboxed_tuple (local_ a) (local_ b) =
let t = #(a, b) in
let #(a', _) = t in
a'
[%%expect{|
val f_unboxed_tuple : local_ 'a -> local_ 'b -> local_ 'a = <fun>
|}]

let f_boxed_tuple (local_ a) (local_ b) =
let t = (a, b) in
let (a', _) = t in
a'
[%%expect{|
Line 4, characters 2-4:
4 | a'
^^
Error: This value escapes its region.
Hint: Cannot return a local value without an "exclave_" annotation.
|}]

0 comments on commit 6d6c68f

Please sign in to comment.