Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_nat takes only Uint32 as argument. Make it non-polymorphic #864

Merged
merged 3 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/base/BuiltIns.ml
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,7 @@ module ScillaBuiltIns (SR : Rep) (ER : Rep) = struct

let to_nat_arity = 1

let to_nat_type = tfun_typ "'A" @@ fun_typ (tvar "'A") nat_typ

let to_nat_elab sc ts =
match ts with
| [ t ] when is_uint_type t -> elab_tfun_with_args_no_gas sc [ t ]
| _ -> fail0 "Failed to elaborate"
let to_nat_type = fun_typ uint32_typ nat_typ

let to_nat ls _ =
match ls with
Expand Down Expand Up @@ -1371,7 +1366,7 @@ module ScillaBuiltIns (SR : Rep) (ER : Rep) = struct
| Builtin_to_uint32 -> [Uint.to_uint_arity, Uint.to_uint_type, Uint.to_uint_elab Bits32, Uint.to_uint32]
| Builtin_to_uint64 -> [Uint.to_uint_arity, Uint.to_uint_type, Uint.to_uint_elab Bits64, Uint.to_uint64]
| Builtin_to_uint128 -> [Uint.to_uint_arity, Uint.to_uint_type, Uint.to_uint_elab Bits128, Uint.to_uint128]
| Builtin_to_nat -> [Uint.to_nat_arity, Uint.to_nat_type, Uint.to_nat_elab, Uint.to_nat]
| Builtin_to_nat -> [Uint.to_nat_arity, Uint.to_nat_type, elab_id, Uint.to_nat]

[@@@ocamlformat "enable"]

Expand Down
2 changes: 1 addition & 1 deletion src/base/Gas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ module ScillaGas (SR : Rep) (ER : Rep) = struct
(Builtin_to_uint64, [tvar "'A"], int_conversion_coster 64, 4);
(Builtin_to_uint128, [tvar "'A"], int_conversion_coster 128, 4);
(Builtin_to_uint256, [tvar "'A"], int_conversion_coster 256, 4);
(Builtin_to_nat, [tvar "'A"], to_nat_coster, 1);
(Builtin_to_nat, [uint32_typ], to_nat_coster, 1);
]

[@@@ocamlformat "enable"]
Expand Down