Skip to content

Commit 36bce82

Browse files
authored
flambda-backend: Use the right kinds when building shapes for unboxed variants (#2735)
1 parent 74e6758 commit 36bce82

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(* TEST
2+
flags = "-extension layouts_beta";
3+
native;
4+
*)
5+
6+
(* Unboxing of variants with mixed constructors *)
7+
8+
type t =
9+
| Const_t
10+
| Boxed of Float.t
11+
12+
type u =
13+
| Const_u
14+
| Unboxed of float#
15+
16+
external unbox : float -> float# = "%unbox_float"
17+
18+
let t_to_u (t : t) : u =
19+
match t with
20+
| Const_t -> Const_u
21+
| Boxed field -> Unboxed (unbox field)
22+
;;
23+
24+
let f t =
25+
(* The result of [t_to_u] is speculatively unboxed *)
26+
let _ = t_to_u t in
27+
()
28+
;;

0 commit comments

Comments
 (0)