Skip to content

Commit b74ea89

Browse files
authored
flambda-backend: Zero alloc fix assume payload parsing (#2152)
Fix a bug in payload detection for [@zero_alloc assume ..] Correctly detect the following [@zero_alloc assume never_returns_normally strict] payload keywords passed to [parse_ids_payload] must be sorted alphabetically.
1 parent 2ab8999 commit b74ea89

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lambda/translattribute.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ let get_ids_from_exp exp =
136136
|> Result.map List.rev
137137

138138

139+
(* [parse_ids_payload] requires that each element in [cases]
140+
the first component (string list) is alphabetically sorted. *)
139141
let parse_ids_payload txt loc ~default ~empty cases payload =
140142
let[@local] warn () =
141143
let ( %> ) f g x = g (f x) in
@@ -270,7 +272,7 @@ let parse_property_attribute attr property =
270272
Assume { property; strict = true; never_returns_normally = false; loc; };
271273
["assume"; "never_returns_normally"],
272274
Assume { property; strict = false; never_returns_normally = true; loc; };
273-
["assume"; "strict"; "never_returns_normally"],
275+
["assume"; "never_returns_normally"; "strict";],
274276
Assume { property; strict = true; never_returns_normally = true; loc; };
275277
["ignore"], Ignore_assert_all property
276278
]

0 commit comments

Comments
 (0)