Skip to content

Commit

Permalink
Update src/lowering/desugar.ml
Browse files Browse the repository at this point in the history
Make setting `Cycles.add` penetrate through parentheticals (that don't mention `cycles`).

Co-authored-by: Claudio Russo <[email protected]>
  • Loading branch information
ggreif and crusso committed Feb 25, 2025
1 parent ee4c2ad commit 0189496
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

* Added support for sending `cycles` and setting a `timeout` in parentheticals.
This is an **experimental feature**, with new syntax, and now also allowing best-effort
message sends. The legacy call `Cycles.add<system>` is still supported, but the
two approaches cannot be mixed (#4608).
message sends. The legacy call `Cycles.add<system>` is still supported (#4608).

For example, if one wants to attach cycles to a message send, prefix it with a parenthetical
``` motoko
Expand Down
2 changes: 1 addition & 1 deletion src/lowering/desugar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ and parenthetical = function
let cycles, clean_cycles =
if T.(sub par.note.note_typ (Obj (Object, [T.cycles_fld])))
then [fun parV -> dotE parV T.cycles_lab T.nat |> assignVarE "@cycles" |> expD], []
else [], [natE Mo_values.Numerics.Nat.zero |> assignVarE "@cycles" |> expD] in
else [], [] in
let timeout, clean_timeout =
if T.(sub par.note.note_typ (Obj (Object, [T.timeout_fld])))
then [fun parV -> dotE parV T.timeout_lab T.nat32 |> optE |> assignVarE "@timeout" |> expD], []
Expand Down

0 comments on commit 0189496

Please sign in to comment.