Contracts now compile.

This commit is contained in:
Sander Spies 2020-06-04 09:54:25 +02:00
parent c8ed8c38cc
commit c30ade3b85
52 changed files with 368 additions and 358 deletions

View File

@ -98,7 +98,7 @@ and pp_bytes {value; _} =
string ("0x" ^ Hex.show (snd value))
and pp_ppar {value; _} =
nest 1 (pp_pattern value.inside)
string "(" ^^ nest 1 (pp_pattern value.inside) ^^ string ")"
and pp_plist = function
PListComp cmp -> pp_list_comp cmp
@ -286,7 +286,7 @@ and pp_record_expr ne_inj = pp_ne_injection pp_field_assign ne_inj
and pp_field_assign {value; _} =
let {field_name; field_expr; _} = value in
prefix 2 1 (pp_ident field_name ^^ string " =") (pp_expr field_expr)
prefix 2 1 (pp_ident field_name ^^ string ":") (pp_expr field_expr)
and pp_ne_injection :
'a.('a -> document) -> 'a ne_injection reg -> document =
@ -315,13 +315,13 @@ and pp_nseq : 'a.('a -> document) -> 'a Utils.nseq -> document =
and pp_projection {value; _} =
let {struct_name; field_path; _ } = value in
let fields = Utils.nsepseq_to_list field_path
and sep = string "." ^^ break 0 in
and sep = break 0 in
let fields = separate_map sep pp_selection fields in
group (pp_ident struct_name ^^ break 0 ^^ string "[" ^^ fields ^^ string "]")
group (pp_ident struct_name ^^ break 0 ^^ fields)
and pp_selection = function
FieldName v -> string v.value
| Component cmp -> cmp.value |> snd |> Z.to_string |> string
FieldName v -> string "." ^^ string v.value
| Component cmp -> string "[" ^^ (cmp.value |> snd |> Z.to_string |> string) ^^ string "]"
and pp_update {value; _} =
let {record; updates; _} = value in
@ -343,7 +343,10 @@ and pp_path = function
and pp_call_expr {value; _} =
let lambda, arguments = value in
let arguments = string "(" ^^ pp_nseq pp_expr arguments ^^ string ")" in
let arguments = Utils.nseq_to_list arguments in
let arguments = string "(" ^^ group (separate_map (string "," ^^ break 0 ^^ string " ") pp_expr arguments) ^^ string ")" in
(* let arguments = string "(" ^^ pp_nseq pp_expr arguments ^^ string ")" in *)
group (break 0 ^^ pp_expr lambda ^^ nest 2 arguments)
and pp_tuple_expr {value; _} =
@ -412,7 +415,8 @@ and pp_cartesian {value; _} =
| [e] -> group (break 1 ^^ pp_type_expr e)
| e::items ->
group (break 1 ^^ pp_type_expr e ^^ string ",") ^^ app items
in string "(" ^^ pp_type_expr head ^^ string "," ^^ app (List.map snd tail) ^^ string ")"
in
string "(" ^^ pp_type_expr head ^^ (if tail <> [] then string "," else empty) ^^ app (List.map snd tail) ^^ string ")"
and pp_variants {value; _} =
let head, tail = value in
@ -473,7 +477,7 @@ and pp_fun_type {value; _} =
let lhs, _, rhs = value in
match rhs with
| TFun tf -> string "(" ^^ pp_type_expr lhs ^^ string ", " ^^ pp_fun_args tf
| _ -> group (pp_type_expr lhs ^^ string ")" ^^ string " =>" ^/^ pp_type_expr rhs)
| _ -> group (string "(" ^^ pp_type_expr lhs ^^ string " =>" ^/^ pp_type_expr rhs ^^ string ")")
(* group (string "(" ^^ pp_type_expr lhs ^^ string ")" ^^ string " =>" ^/^ pp_type_expr rhs) *)

View File

@ -1,57 +1,57 @@
(rule (targets address.output) (action (with-stdout-to address.output (run ligo "pretty-print" "address.religo"))))
(rule (targets amount.output) (action (with-stdout-to amount.output (run ligo "pretty-print" "amount.religo"))))
(rule (targets arithmetic.output) (action (with-stdout-to arithmetic.output (run ligo "pretty-print" "arithmetic.religo"))))
(rule (targets bad_address_format.output) (action (with-stdout-to bad_address_format.output (run ligo "pretty-print" "bad_address_format.religo"))))
(rule (targets balance_constant.output) (action (with-stdout-to balance_constant.output (run ligo "pretty-print" "balance_constant.religo"))))
(rule (targets bitwise_arithmetic.output) (action (with-stdout-to bitwise_arithmetic.output (run ligo "pretty-print" "bitwise_arithmetic.religo"))))
(rule (targets boolean_operators.output) (action (with-stdout-to boolean_operators.output (run ligo "pretty-print" "boolean_operators.religo"))))
(rule (targets bytes_arithmetic.output) (action (with-stdout-to bytes_arithmetic.output (run ligo "pretty-print" "bytes_arithmetic.religo"))))
(rule (targets bytes_unpack.output) (action (with-stdout-to bytes_unpack.output (run ligo "pretty-print" "bytes_unpack.religo"))))
(rule (targets check_signature.output) (action (with-stdout-to check_signature.output (run ligo "pretty-print" "check_signature.religo"))))
(rule (targets closure.output) (action (with-stdout-to closure.output (run ligo "pretty-print" "closure.religo"))))
(rule (targets condition-shadowing.output) (action (with-stdout-to condition-shadowing.output (run ligo "pretty-print" "condition-shadowing.religo"))))
(rule (targets condition.output) (action (with-stdout-to condition.output (run ligo "pretty-print" "condition.religo"))))
(rule (targets counter.output) (action (with-stdout-to counter.output (run ligo "pretty-print" "counter.religo"))))
(rule (targets crypto.output) (action (with-stdout-to crypto.output (run ligo "pretty-print" "crypto.religo"))))
(rule (targets empty_case.output) (action (with-stdout-to empty_case.output (run ligo "pretty-print" "empty_case.religo"))))
(rule (targets eq_bool.output) (action (with-stdout-to eq_bool.output (run ligo "pretty-print" "eq_bool.religo"))))
(rule (targets failwith.output) (action (with-stdout-to failwith.output (run ligo "pretty-print" "failwith.religo"))))
(rule (targets function-shared.output) (action (with-stdout-to function-shared.output (run ligo "pretty-print" "function-shared.religo"))))
(rule (targets high-order.output) (action (with-stdout-to high-order.output (run ligo "pretty-print" "high-order.religo"))))
(rule (targets implicit_account.output) (action (with-stdout-to implicit_account.output (run ligo "pretty-print" "implicit_account.religo"))))
(rule (targets included.output) (action (with-stdout-to included.output (run ligo "pretty-print" "included.religo"))))
(rule (targets includer.output) (action (with-stdout-to includer.output (run ligo "pretty-print" "includer.religo"))))
(rule (targets key_hash.output) (action (with-stdout-to key_hash.output (run ligo "pretty-print" "key_hash.religo"))))
(rule (targets lambda.output) (action (with-stdout-to lambda.output (run ligo "pretty-print" "lambda.religo"))))
(rule (targets lambda2.output) (action (with-stdout-to lambda2.output (run ligo "pretty-print" "lambda2.religo"))))
(rule (targets let_multiple.output) (action (with-stdout-to let_multiple.output (run ligo "pretty-print" "let_multiple.religo"))))
(rule (targets letin.output) (action (with-stdout-to letin.output (run ligo "pretty-print" "letin.religo"))))
(rule (targets list.output) (action (with-stdout-to list.output (run ligo "pretty-print" "list.religo"))))
(rule (targets loop.output) (action (with-stdout-to loop.output (run ligo "pretty-print" "loop.religo"))))
(rule (targets map.output) (action (with-stdout-to map.output (run ligo "pretty-print" "map.religo"))))
(rule (targets match_bis.output) (action (with-stdout-to match_bis.output (run ligo "pretty-print" "match_bis.religo"))))
(rule (targets match.output) (action (with-stdout-to match.output (run ligo "pretty-print" "match.religo"))))
(rule (targets michelson_pair_tree.output) (action (with-stdout-to michelson_pair_tree.output (run ligo "pretty-print" "michelson_pair_tree.religo"))))
(rule (targets multiple-parameters.output) (action (with-stdout-to multiple-parameters.output (run ligo "pretty-print" "multiple-parameters.religo"))))
(rule (targets multisig.output) (action (with-stdout-to multisig.output (run ligo "pretty-print" "multisig.religo"))))
(rule (targets no_semicolon.output) (action (with-stdout-to no_semicolon.output (run ligo "pretty-print" "no_semicolon.religo"))))
(rule (targets pledge.output) (action (with-stdout-to pledge.output (run ligo "pretty-print" "pledge.religo"))))
(rule (targets record.output) (action (with-stdout-to record.output (run ligo "pretty-print" "record.religo"))))
(rule (targets recursion.output) (action (with-stdout-to recursion.output (run ligo "pretty-print" "recursion.religo"))))
(rule (targets self_address.output) (action (with-stdout-to self_address.output (run ligo "pretty-print" "self_address.religo"))))
(rule (targets set_arithmetic.output) (action (with-stdout-to set_arithmetic.output (run ligo "pretty-print" "set_arithmetic.religo"))))
(rule (targets set_delegate.output) (action (with-stdout-to set_delegate.output (run ligo "pretty-print" "set_delegate.religo"))))
(rule (targets single_record_item.output) (action (with-stdout-to single_record_item.output (run ligo "pretty-print" "single_record_item.religo"))))
(rule (targets string_arithmetic.output) (action (with-stdout-to string_arithmetic.output (run ligo "pretty-print" "string_arithmetic.religo"))))
(rule (targets super-counter.output) (action (with-stdout-to super-counter.output (run ligo "pretty-print" "super-counter.religo"))))
(rule (targets tuple_list.output) (action (with-stdout-to tuple_list.output (run ligo "pretty-print" "tuple_list.religo"))))
(rule (targets tuple_param_destruct.output) (action (with-stdout-to tuple_param_destruct.output (run ligo "pretty-print" "tuple_param_destruct.religo"))))
(rule (targets tuple_type.output) (action (with-stdout-to tuple_type.output (run ligo "pretty-print" "tuple_type.religo"))))
(rule (targets tuple.output) (action (with-stdout-to tuple.output (run ligo "pretty-print" "tuple.religo"))))
(rule (targets tuples_no_annotation.output) (action (with-stdout-to tuples_no_annotation.output (run ligo "pretty-print" "tuples_no_annotation.religo"))))
(rule (targets tuples_sequences_functions.output) (action (with-stdout-to tuples_sequences_functions.output (run ligo "pretty-print" "tuples_sequences_functions.religo"))))
(rule (targets variant.output) (action (with-stdout-to variant.output (run ligo "pretty-print" "variant.religo"))))
(rule (targets website2.output) (action (with-stdout-to website2.output (run ligo "pretty-print" "website2.religo"))))
(rule (targets address.output) (action (with-stdout-to address.output (run ligo "pretty-print" "address.religo"))) (deps address.religo))
(rule (targets amount.output) (action (with-stdout-to amount.output (run ligo "pretty-print" "amount.religo"))) (deps amount.religo))
(rule (targets arithmetic.output) (action (with-stdout-to arithmetic.output (run ligo "pretty-print" "arithmetic.religo"))) (deps arithmetic.religo))
(rule (targets bad_address_format.output) (action (with-stdout-to bad_address_format.output (run ligo "pretty-print" "bad_address_format.religo"))) (deps bad_address_format.religo))
(rule (targets balance_constant.output) (action (with-stdout-to balance_constant.output (run ligo "pretty-print" "balance_constant.religo"))) (deps balance_constant.religo))
(rule (targets bitwise_arithmetic.output) (action (with-stdout-to bitwise_arithmetic.output (run ligo "pretty-print" "bitwise_arithmetic.religo"))) (deps bitwise_arithmetic.religo))
(rule (targets boolean_operators.output) (action (with-stdout-to boolean_operators.output (run ligo "pretty-print" "boolean_operators.religo"))) (deps boolean_operators.religo))
(rule (targets bytes_arithmetic.output) (action (with-stdout-to bytes_arithmetic.output (run ligo "pretty-print" "bytes_arithmetic.religo"))) (deps bytes_arithmetic.religo))
(rule (targets bytes_unpack.output) (action (with-stdout-to bytes_unpack.output (run ligo "pretty-print" "bytes_unpack.religo"))) (deps bytes_unpack.religo))
(rule (targets check_signature.output) (action (with-stdout-to check_signature.output (run ligo "pretty-print" "check_signature.religo"))) (deps check_signature.religo))
(rule (targets closure.output) (action (with-stdout-to closure.output (run ligo "pretty-print" "closure.religo"))) (deps closure.religo))
(rule (targets condition-shadowing.output) (action (with-stdout-to condition-shadowing.output (run ligo "pretty-print" "condition-shadowing.religo"))) (deps condition-shadowing.religo))
(rule (targets condition.output) (action (with-stdout-to condition.output (run ligo "pretty-print" "condition.religo"))) (deps condition.religo))
(rule (targets counter.output) (action (with-stdout-to counter.output (run ligo "pretty-print" "counter.religo"))) (deps counter.religo))
(rule (targets crypto.output) (action (with-stdout-to crypto.output (run ligo "pretty-print" "crypto.religo"))) (deps crypto.religo))
(rule (targets empty_case.output) (action (with-stdout-to empty_case.output (run ligo "pretty-print" "empty_case.religo"))) (deps empty_case.religo))
(rule (targets eq_bool.output) (action (with-stdout-to eq_bool.output (run ligo "pretty-print" "eq_bool.religo"))) (deps eq_bool.religo))
(rule (targets failwith.output) (action (with-stdout-to failwith.output (run ligo "pretty-print" "failwith.religo"))) (deps failwith.religo))
(rule (targets function-shared.output) (action (with-stdout-to function-shared.output (run ligo "pretty-print" "function-shared.religo"))) (deps function-shared.religo))
(rule (targets high-order.output) (action (with-stdout-to high-order.output (run ligo "pretty-print" "high-order.religo"))) (deps high-order.religo))
(rule (targets implicit_account.output) (action (with-stdout-to implicit_account.output (run ligo "pretty-print" "implicit_account.religo"))) (deps implicit_account.religo))
(rule (targets included.output) (action (with-stdout-to included.output (run ligo "pretty-print" "included.religo"))) (deps included.religo))
(rule (targets includer.output) (action (with-stdout-to includer.output (run ligo "pretty-print" "includer.religo"))) (deps includer.religo))
(rule (targets key_hash.output) (action (with-stdout-to key_hash.output (run ligo "pretty-print" "key_hash.religo"))) (deps key_hash.religo))
(rule (targets lambda.output) (action (with-stdout-to lambda.output (run ligo "pretty-print" "lambda.religo"))) (deps lambda.religo))
(rule (targets lambda2.output) (action (with-stdout-to lambda2.output (run ligo "pretty-print" "lambda2.religo"))) (deps lambda2.religo))
(rule (targets let_multiple.output) (action (with-stdout-to let_multiple.output (run ligo "pretty-print" "let_multiple.religo"))) (deps let_multiple.religo))
(rule (targets letin.output) (action (with-stdout-to letin.output (run ligo "pretty-print" "letin.religo"))) (deps letin.religo))
(rule (targets list.output) (action (with-stdout-to list.output (run ligo "pretty-print" "list.religo"))) (deps list.religo))
(rule (targets loop.output) (action (with-stdout-to loop.output (run ligo "pretty-print" "loop.religo"))) (deps loop.religo))
(rule (targets map.output) (action (with-stdout-to map.output (run ligo "pretty-print" "map.religo"))) (deps map.religo))
(rule (targets match_bis.output) (action (with-stdout-to match_bis.output (run ligo "pretty-print" "match_bis.religo"))) (deps match_bis.religo))
(rule (targets match.output) (action (with-stdout-to match.output (run ligo "pretty-print" "match.religo"))) (deps match.religo))
(rule (targets michelson_pair_tree.output) (action (with-stdout-to michelson_pair_tree.output (run ligo "pretty-print" "michelson_pair_tree.religo"))) (deps michelson_pair_tree.religo))
(rule (targets multiple-parameters.output) (action (with-stdout-to multiple-parameters.output (run ligo "pretty-print" "multiple-parameters.religo"))) (deps multiple-parameters.religo))
(rule (targets multisig.output) (action (with-stdout-to multisig.output (run ligo "pretty-print" "multisig.religo"))) (deps multisig.religo))
(rule (targets no_semicolon.output) (action (with-stdout-to no_semicolon.output (run ligo "pretty-print" "no_semicolon.religo"))) (deps no_semicolon.religo))
(rule (targets pledge.output) (action (with-stdout-to pledge.output (run ligo "pretty-print" "pledge.religo"))) (deps pledge.religo))
(rule (targets record.output) (action (with-stdout-to record.output (run ligo "pretty-print" "record.religo"))) (deps record.religo))
(rule (targets recursion.output) (action (with-stdout-to recursion.output (run ligo "pretty-print" "recursion.religo"))) (deps recursion.religo))
(rule (targets self_address.output) (action (with-stdout-to self_address.output (run ligo "pretty-print" "self_address.religo"))) (deps self_address.religo))
(rule (targets set_arithmetic.output) (action (with-stdout-to set_arithmetic.output (run ligo "pretty-print" "set_arithmetic.religo"))) (deps set_arithmetic.religo))
(rule (targets set_delegate.output) (action (with-stdout-to set_delegate.output (run ligo "pretty-print" "set_delegate.religo"))) (deps set_delegate.religo))
(rule (targets single_record_item.output) (action (with-stdout-to single_record_item.output (run ligo "pretty-print" "single_record_item.religo"))) (deps single_record_item.religo))
(rule (targets string_arithmetic.output) (action (with-stdout-to string_arithmetic.output (run ligo "pretty-print" "string_arithmetic.religo"))) (deps string_arithmetic.religo))
(rule (targets super-counter.output) (action (with-stdout-to super-counter.output (run ligo "pretty-print" "super-counter.religo"))) (deps super-counter.religo))
(rule (targets tuple_list.output) (action (with-stdout-to tuple_list.output (run ligo "pretty-print" "tuple_list.religo"))) (deps tuple_list.religo))
(rule (targets tuple_param_destruct.output) (action (with-stdout-to tuple_param_destruct.output (run ligo "pretty-print" "tuple_param_destruct.religo"))) (deps tuple_param_destruct.religo))
(rule (targets tuple_type.output) (action (with-stdout-to tuple_type.output (run ligo "pretty-print" "tuple_type.religo"))) (deps tuple_type.religo))
(rule (targets tuple.output) (action (with-stdout-to tuple.output (run ligo "pretty-print" "tuple.religo"))) (deps tuple.religo))
(rule (targets tuples_no_annotation.output) (action (with-stdout-to tuples_no_annotation.output (run ligo "pretty-print" "tuples_no_annotation.religo"))) (deps tuples_no_annotation.religo))
(rule (targets tuples_sequences_functions.output) (action (with-stdout-to tuples_sequences_functions.output (run ligo "pretty-print" "tuples_sequences_functions.religo"))) (deps tuples_sequences_functions.religo))
(rule (targets variant.output) (action (with-stdout-to variant.output (run ligo "pretty-print" "variant.religo"))) (deps variant.religo))
(rule (targets website2.output) (action (with-stdout-to website2.output (run ligo "pretty-print" "website2.religo"))) (deps website2.religo))
(alias (name runtest) (action (diff expected/address.religo address.output)))
@ -109,57 +109,57 @@
(alias (name runtest) (action (diff expected/variant.religo variant.output)))
(alias (name runtest) (action (diff expected/website2.religo website2.output)))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst address.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst amount.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst arithmetic.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bad_address_format.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst balance_constant.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bitwise_arithmetic.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst boolean_operators.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bytes_arithmetic.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bytes_unpack.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst check_signature.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst closure.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst condition-shadowing.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst condition.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst counter.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst crypto.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst empty_case.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst eq_bool.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst failwith.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst function-shared.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst high-order.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst implicit_account.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst included.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst includer.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst key_hash.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst lambda.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst lambda2.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst let_multiple.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst letin.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst list.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst loop.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst map.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst match_bis.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst match.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst michelson_pair_tree.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst multiple-parameters.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst multisig.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst no_semicolon.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst pledge.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst record.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst recursion.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst self_address.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst set_arithmetic.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst set_delegate.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst single_record_item.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst string_arithmetic.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst super-counter.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple_list.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple_param_destruct.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple_type.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuples_no_annotation.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuples_sequences_functions.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst variant.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst website2.output -s reasonligo))))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst address.output -s reasonligo))) (deps address.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst amount.output -s reasonligo))) (deps amount.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst arithmetic.output -s reasonligo))) (deps arithmetic.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bad_address_format.output -s reasonligo))) (deps bad_address_format.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst balance_constant.output -s reasonligo))) (deps balance_constant.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bitwise_arithmetic.output -s reasonligo))) (deps bitwise_arithmetic.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst boolean_operators.output -s reasonligo))) (deps boolean_operators.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bytes_arithmetic.output -s reasonligo))) (deps bytes_arithmetic.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst bytes_unpack.output -s reasonligo))) (deps bytes_unpack.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst check_signature.output -s reasonligo))) (deps check_signature.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst closure.output -s reasonligo))) (deps closure.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst condition-shadowing.output -s reasonligo))) (deps condition-shadowing.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst condition.output -s reasonligo))) (deps condition.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst counter.output -s reasonligo))) (deps counter.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst crypto.output -s reasonligo))) (deps crypto.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst empty_case.output -s reasonligo))) (deps empty_case.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst eq_bool.output -s reasonligo))) (deps eq_bool.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst failwith.output -s reasonligo))) (deps failwith.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst function-shared.output -s reasonligo))) (deps function-shared.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst high-order.output -s reasonligo))) (deps high-order.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst implicit_account.output -s reasonligo))) (deps implicit_account.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst included.output -s reasonligo))) (deps included.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst includer.output -s reasonligo))) (deps includer.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst key_hash.output -s reasonligo))) (deps key_hash.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst lambda.output -s reasonligo))) (deps lambda.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst lambda2.output -s reasonligo))) (deps lambda2.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst let_multiple.output -s reasonligo))) (deps let_multiple.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst letin.output -s reasonligo))) (deps letin.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst list.output -s reasonligo))) (deps list.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst loop.output -s reasonligo))) (deps loop.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst map.output -s reasonligo))) (deps map.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst match_bis.output -s reasonligo))) (deps match_bis.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst match.output -s reasonligo))) (deps match.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst michelson_pair_tree.output -s reasonligo))) (deps michelson_pair_tree.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst multiple-parameters.output -s reasonligo))) (deps multiple-parameters.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst multisig.output -s reasonligo))) (deps multisig.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst no_semicolon.output -s reasonligo))) (deps no_semicolon.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst pledge.output -s reasonligo))) (deps pledge.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst record.output -s reasonligo))) (deps record.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst recursion.output -s reasonligo))) (deps recursion.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst self_address.output -s reasonligo))) (deps self_address.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst set_arithmetic.output -s reasonligo))) (deps set_arithmetic.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst set_delegate.output -s reasonligo))) (deps set_delegate.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst single_record_item.output -s reasonligo))) (deps single_record_item.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst string_arithmetic.output -s reasonligo))) (deps string_arithmetic.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst super-counter.output -s reasonligo))) (deps super-counter.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple_list.output -s reasonligo))) (deps tuple_list.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple_param_destruct.output -s reasonligo))) (deps tuple_param_destruct.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple_type.output -s reasonligo))) (deps tuple_type.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuple.output -s reasonligo))) (deps tuple.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuples_no_annotation.output -s reasonligo))) (deps tuples_no_annotation.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst tuples_sequences_functions.output -s reasonligo))) (deps tuples_sequences_functions.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst variant.output -s reasonligo))) (deps variant.output))
(alias (name runtest) (action (ignore-stdout (run ligo print-cst website2.output -s reasonligo))) (deps website2.output))

View File

@ -1,5 +1,5 @@
let main =
(p: key_hash): address =>
((p: key_hash)): address =>
{
let c: contract(unit) = Tezos.implicit_account(p);
Tezos.address(c)

View File

@ -1,5 +1,5 @@
let check_ =
(p: unit): int =>
((p: unit)): int =>
if(Tezos.amount
== 100000000mutez) {
42

View File

@ -1,17 +1,17 @@
let mod_op = (n: int): nat => n mod 42;
let mod_op = ((n: int)): nat => n mod 42;
let plus_op = (n: int): int => n + 42;
let plus_op = ((n: int)): int => n + 42;
let minus_op = (n: int): int => n - 42;
let minus_op = ((n: int)): int => n - 42;
let times_op = (n: int): int => n * 42;
let times_op = ((n: int)): int => n * 42;
let div_op = (n: int): int => n / 2;
let div_op = ((n: int)): int => n / 2;
let neg_op = (n: int): int => -n;
let neg_op = ((n: int)): int => -n;
let foo = (n: int): int => n + 10;
let foo = ((n: int)): int => n + 10;
let neg_op_2 = (b: int): int => -foo(b);
let neg_op_2 = ((b: int)): int => -foo(b);
let ediv_op = (n: int): option((int, nat)) => ediv(n 2);
let ediv_op = ((n: int)): option((int, nat)) => ediv(n, 2);

View File

@ -1,3 +1,3 @@
let main =
(parameter: int, storage: address) =>
((parameter: int), (storage: address)) =>
([] : list(operation), "KT1badaddr" : address);

View File

@ -1,7 +1,7 @@
type storage = tez;
let main2 =
(p: unit, s: storage) =>
((p: unit), (s: storage)) =>
([] : list(operation), Tezos.balance);
let main = (x: (unit, storage)) => main2(x[0] x[1]);
let main = ((x: (unit, storage))) => main2(x[0], x[1]);

View File

@ -1,9 +1,9 @@
let or_op = (n: nat): nat => Bitwise.or(n 4n);
let or_op = ((n: nat)): nat => Bitwise.or(n, 4n);
let and_op = (n: nat): nat => Bitwise.and(n 7n);
let and_op = ((n: nat)): nat => Bitwise.and(n, 7n);
let xor_op = (n: nat): nat => Bitwise.xor(n 7n);
let xor_op = ((n: nat)): nat => Bitwise.xor(n, 7n);
let lsl_op = (n: nat): nat => Bitwise.shift_left(n 7n);
let lsl_op = ((n: nat)): nat => Bitwise.shift_left(n, 7n);
let lsr_op = (n: nat): nat => Bitwise.shift_right(n 7n);
let lsr_op = ((n: nat)): nat => Bitwise.shift_right(n, 7n);

View File

@ -1,9 +1,9 @@
let or_true = (b: bool): bool => b || true;
let or_true = ((b: bool)): bool => b || true;
let or_false = (b: bool): bool => b || false;
let or_false = ((b: bool)): bool => b || false;
let and_true = (b: bool): bool => b && true;
let and_true = ((b: bool)): bool => b && true;
let and_false = (b: bool): bool => b && false;
let and_false = ((b: bool)): bool => b && false;
let not_bool = (b: bool): bool => ! b;
let not_bool = ((b: bool)): bool => ! b;

View File

@ -1,5 +1,6 @@
let concat_op = (s: bytes): bytes => Bytes.concat(s 0x7070);
let concat_op =
((s: bytes)): bytes => Bytes.concat(s, 0x7070);
let slice_op = (s: bytes): bytes => Bytes.slice(1n 2n s);
let slice_op = ((s: bytes)): bytes => Bytes.slice(1n, 2n, s);
let hasherman = (s: bytes): bytes => Crypto.sha256(s);
let hasherman = ((s: bytes)): bytes => Crypto.sha256(s);

View File

@ -1,19 +1,19 @@
let id_string =
(p: string): option(string) =>
((p: string)): option(string) =>
{
let packed: bytes = Bytes.pack(p);
((Bytes.unpack(packed)) : option(string))
};
let id_int =
(p: int): option(int) =>
((p: int)): option(int) =>
{
let packed: bytes = Bytes.pack(p);
((Bytes.unpack(packed)) : option(int))
};
let id_address =
(p: address): option(address) =>
((p: address)): option(address) =>
{
let packed: bytes = Bytes.pack(p);
((Bytes.unpack(packed)) : option(address))

View File

@ -1,6 +1,6 @@
let check_signature =
(param: (key, signature, bytes)): bool =>
((param: (key, signature, bytes))): bool =>
{
let (pk, signed, msg) = param;
Crypto.check(pk signed msg)
Crypto.check(pk, signed, msg)
};

View File

@ -1,8 +1,8 @@
let test =
(k: int): int =>
((k: int)): int =>
{
let j: int = k + 5;
let close: (int) => int) = (i: int) => i + j;
let close: ((int => int)) = ((i: int)) => i + j;
let j: int = 20;
close(20)
};

View File

@ -1,5 +1,5 @@
let main =
(i: int) =>
((i: int)) =>
{
let result = 0;
if(i

View File

@ -1,5 +1,5 @@
let main =
(i: int) =>
((i: int)) =>
if(i
== 2) {
42

View File

@ -1,5 +1,5 @@
type storage = int;
let main =
((p, s): (int, storage)): (list(operation), storage) =>
(((p, s): (int, storage))): (list(operation), storage) =>
([] : list(operation), p + s);

View File

@ -1,3 +1,3 @@
let hasherman512 = (s: bytes) => Crypto.sha512(s);
let hasherman512 = ((s: bytes)) => Crypto.sha512(s);
let hasherman_blake = (s: bytes) => Crypto.blake2b(s);
let hasherman_blake = ((s: bytes)) => Crypto.blake2b(s);

View File

@ -1,8 +1,8 @@
type foo = Bar(int) | Baz;
let main =
(f: foo): int =>
((f: foo)): int =>
switch(f) {
| Bari => i
| Bar(i) => i
| Baz => (-1)
};

View File

@ -1,5 +1,5 @@
let main =
((a, b): (bool, bool)) =>
(((a, b): (bool, bool))) =>
if(a
== b) {
999

View File

@ -1,7 +1,7 @@
type storage = unit;
let main =
(p: unit, storage) =>
((p: unit), storage) =>
if(true) {
failwith("This contract always fails")
};

View File

@ -1,5 +1,5 @@
let foo = (i: int): int => i + 20;
let foo = ((i: int)): int => i + 20;
let bar = (i: int): int => i + 50;
let bar = ((i: int)): int => i + 50;
let foobar = (i: int): int => foo(i) + bar(i);
let foobar = ((i: int)): int => foo(i) + bar(i);

View File

@ -1,53 +1,53 @@
let foobar =
(i: int): int =>
((i: int)): int =>
{
let foo: int) => int = (i: int) => i;
let bar: (int) => int) => int) =
(f: int) => int) => f(i);
let foo: (int => int) = ((i: int)) => i;
let bar: (((int => int) => int)) =
((f: (int => int))) => f(i);
bar(foo)
};
let higher2 =
(i: int, f: int) => int): int =>
((i: int), (f: (int => int))): int =>
{
let ii: int = f(i);
ii
};
let foobar2 =
(i: int): int =>
((i: int)): int =>
{
let foo2: int) => int = (i: int) => i;
higher2(i foo2)
let foo2: (int => int) = ((i: int)) => i;
higher2(i, foo2)
};
let a: int = 0;
let foobar3 =
(i: int): int =>
((i: int)): int =>
{
let foo2: int) => int = (i: int) => a + i;
higher2(i foo2)
let foo2: (int => int) = ((i: int)) => a + i;
higher2(i, foo2)
};
let f = (i: int): int => i;
let f = ((i: int)): int => i;
let g = (i: int): int => f(i);
let g = ((i: int)): int => f(i);
let foobar4 = (i: int): int => g(g(i));
let foobar4 = ((i: int)): int => g(g(i));
let higher3 =
(i: int, f: int) => int, g: int) => int): int =>
((i: int), (f: (int => int)), (g: (int => int))): int =>
{
let ii: int = f(g(i));
ii
};
let foobar5 =
(i: int): int =>
((i: int)): int =>
{
let a: int = 0;
let foo: int) => int = (i: int) => a + i;
let goo: int) => int = (i: int) => foo(i);
higher3(i foo goo)
let foo: (int => int) = ((i: int)) => a + i;
let goo: (int => int) = ((i: int)) => foo(i);
higher3(i, foo, goo)
};

View File

@ -1,3 +1,3 @@
let main =
(kh: key_hash): contract(unit) =>
((kh: key_hash)): contract(unit) =>
Tezos.implicit_account(kh);

View File

@ -1,5 +1,5 @@
let check_hash_key =
(kh1_k2: (key_hash, key)): (bool, key_hash) =>
((kh1_k2: (key_hash, key))): (bool, key_hash) =>
{
let (kh1, k2) = kh1_k2;
let kh2: key_hash = Crypto.hash_key(k2);

View File

@ -1,5 +1,5 @@
type storage = unit;
let main =
((p, s): (unit, storage)): unit =>
((useless: unit) => ())(());
(((p, s): (unit, storage))): unit =>
((((useless: unit))) => ())(());

View File

@ -1,5 +1,7 @@
type storage = unit;
let main =
((a, s): (unit, storage)): unit =>
((f: unit) => unit) => f(()))((useless: unit) => unit);
(((a, s): (unit, storage))): unit =>
(((f: (unit => unit))) => f(()))(((useless: unit)) =>
unit);

View File

@ -1,13 +1,13 @@
let (x: int, y: int) = (1, 2);
let (((x: int), (y: int))) = (1, 2);
let main = (p: unit): int => x + y;
let main = ((p: unit)): int => x + y;
let (x: int, y: int) = (3, 3);
let (((x: int), (y: int))) = (3, 3);
let main_paren = (p: unit): int => x + y;
let main_paren = ((p: unit)): int => x + y;
let foobar: (int, int) = (23, 42);
let (foo: int, bar: int) = foobar;
let (((foo: int), (bar: int))) = foobar;
let non_tuple_rhs = (p: unit): int => foo + bar;
let non_tuple_rhs = ((p: unit)): int => foo + bar;

View File

@ -1,24 +1,24 @@
type storage = (int, int);
let main =
(n: (int, storage)): (list(operation), storage) =>
((n: (int, storage))): (list(operation), storage) =>
{
let x: (int, int) =
{
let x: int = 7;
(x + n[0], n[1.0] + n[1.1])
(x + n[0], n[1][0] + n[1][1])
};
([] : list(operation), x)
};
let f0 = (a: string) => true;
let f0 = ((a: string)) => true;
let f1 = (a: string) => true;
let f1 = ((a: string)) => true;
let f2 = (a: string) => true;
let f2 = ((a: string)) => true;
let letin_nesting =
(_: unit) =>
((_: unit)) =>
{
let s = "test";
let p0 = f0(s);
@ -31,7 +31,7 @@ let letin_nesting =
};
let letin_nesting2 =
(x: int) =>
((x: int)) =>
{
let y = 2;
let z = 3;

View File

@ -11,7 +11,7 @@ let y: list(int) = [3, 4, 5];
let z: list(int) = [2, ...y];
let main =
((action, s): (parameter, storage)): return =>
(((action, s): (parameter, storage))): return =>
{
let storage =
switch(action) {
@ -21,22 +21,22 @@ let main =
([] : list(operation), storage)
};
let size_ = (s: list(int)): nat => List.length(s);
let size_ = ((s: list(int))): nat => List.length(s);
let fold_op =
(s: list(int)): int =>
((s: list(int))): int =>
{
let aggregate = (t: (int, int)) => t[0] + t[1];
List.fold(aggregate s 10)
let aggregate = ((t: (int, int))) => t[0] + t[1];
List.fold(aggregate, s, 10)
};
let map_op =
(s: list(int)): list(int) =>
List.map((cur: int) => cur + 1 s);
((s: list(int))): list(int) =>
List.map(((cur: int)) => cur + 1, s);
let iter_op =
(s: list(int)): unit =>
((s: list(int))): unit =>
{
let do_nothing = (useless: int) => unit;
List.iter(do_nothing s)
let do_nothing = ((useless: int)) => unit;
List.iter(do_nothing, s)
};

View File

@ -1,5 +1,5 @@
let rec aux_simple =
(i: int): int =>
((i: int)): int =>
if(i
< 100) {
aux_simple(i + 1)
@ -7,45 +7,45 @@ let rec aux_simple =
i
};
let counter_simple = (n: int): int => aux_simple(n);
let counter_simple = ((n: int)): int => aux_simple(n);
type sum_aggregator = {counter: int, sum: int };
let counter =
(n: int): int =>
((n: int)): int =>
{
let initial: sum_aggregator = {counter = 0, sum = 0 };
let initial: sum_aggregator = {counter: 0, sum: 0 };
let rec aggregate =
(prev: sum_aggregator): int =>
if(prev[counter]
((prev: sum_aggregator)): int =>
if(prev.counter
<= n) {
aggregate({
counter = prev[counter] + 1,
sum = prev[counter] + prev[sum]
counter: prev.counter + 1,
sum: prev.counter + prev.sum
})
} else {
prev[sum]
prev.sum
};
aggregate(initial)
};
let rec aux_nest =
(prev: sum_aggregator): sum_aggregator =>
if(prev[counter]
((prev: sum_aggregator)): sum_aggregator =>
if(prev.counter
< 100) {
let sum: int = prev[sum] + aux_simple(prev[counter]);
aux_nest({counter = prev[counter] + 1, sum = sum })
let sum: int = prev.sum + aux_simple(prev.counter);
aux_nest({counter: prev.counter + 1, sum: sum })
} else {
({counter = prev[counter], sum = prev[sum] })
({counter: prev.counter, sum: prev.sum })
};
let counter_nest =
(n: int): int =>
((n: int)): int =>
{
let initial: sum_aggregator = {counter = 0, sum = 0 };
let initial: sum_aggregator = {counter: 0, sum: 0 };
let out: sum_aggregator = aux_nest(initial);
out[sum]
out.sum
};

View File

@ -13,59 +13,62 @@ let map1: foobar =
let map2: foobar = Map.literal([(23, 0), (42, 0)]);
let set_ =
(n: int, m: foobar): foobar => Map.update(23 Some (n) m);
((n: int), (m: foobar)): foobar =>
Map.update(23, Some (n), m);
let add = (n: int, m: foobar): foobar => Map.add(23 n m);
let add =
((n: int), (m: foobar)): foobar => Map.add(23, n, m);
let rm = (m: foobar): foobar => Map.remove(42 m);
let rm = ((m: foobar)): foobar => Map.remove(42, m);
let patch_ =
(m: foobar): foobar =>
((m: foobar)): foobar =>
Map.literal([(0, 5), (1, 6), (2, 7)]);
let patch_empty =
(m: foobar): foobar =>
((m: foobar)): foobar =>
Map.literal([(0, 0), (1, 1), (2, 2)]);
let patch_deep =
(m: (foobar, nat)): (foobar, nat) =>
((m: (foobar, nat))): (foobar, nat) =>
(Map.literal([(0, 0), (1, 9), (2, 2)]), 10n);
let size_ = (m: foobar): nat => Map.size(m);
let size_ = ((m: foobar)): nat => Map.size(m);
let get = (m: foobar): option(int) => Map.find_opt(42 m);
let get = ((m: foobar)): option(int) => Map.find_opt(42, m);
let get_ = (m: foobar): option(int) => Map.find_opt(42 m);
let get_ = ((m: foobar)): option(int) => Map.find_opt(42, m);
let mem = (km: (int, foobar)): bool => Map.mem(km[0] km[1]);
let mem =
((km: (int, foobar))): bool => Map.mem(km[0], km[1]);
let iter_op =
(m: foobar): unit =>
((m: foobar)): unit =>
{
let assert_eq = (i: int, j: int) => assert(i == j);
Map.iter(assert_eq m)
let assert_eq = ((i: int), (j: int)) => assert(i == j);
Map.iter(assert_eq, m)
};
let map_op =
(m: foobar): foobar =>
((m: foobar)): foobar =>
{
let increment = (z: int, j: int) => j + 1;
Map.map(increment m)
let increment = ((z: int), (j: int)) => j + 1;
Map.map(increment, m)
};
let fold_op =
(m: foobar): foobar =>
((m: foobar)): foobar =>
{
let aggregate =
(i: int, j: (int, int)) => i + j[0] + j[1];
Map.fold(aggregate m 10)
((i: int), (j: (int, int))) => i + j[0] + j[1];
Map.fold(aggregate, m, 10)
};
let deep_op =
(m: foobar): foobar =>
((m: foobar)): foobar =>
{
let coco = (0, m);
let coco = (0, Map.remove(42 coco[1]));
let coco = (0, Map.update(32 Some (16) coco[1]));
let coco = (0, Map.remove(42, coco[1]));
let coco = (0, Map.update(32, Some (16), coco[1]));
coco[1]
};

View File

@ -5,13 +5,13 @@ type parameter = Add(int) | Sub(int);
type return = (list(operation), storage);
let main =
((action, store): (parameter, storage)) =>
(((action, store): (parameter, storage))) =>
{
let store =
store
+ (switch(action) {
| Addn => n
| Subn => -n
| Add(n) => n
| Sub(n) => -n
});
(([] : list(operation)), store)
};

View File

@ -2,17 +2,17 @@ type storage = int;
type parameter = Increment(int) | Decrement(int);
let add = (a: int, b: int) => a + b;
let add = (((a: int)), ((b: int))) => a + b;
let sub = (a: int, b: int) => a - b;
let sub = (((a: int)), ((b: int))) => a - b;
let main =
((action, store): (parameter, storage)) =>
(((action, store): (parameter, storage))) =>
{
let store =
switch(action) {
| Incrementn => add(store n)
| Decrementn => sub(store n)
| Increment(n) => add(store, n)
| Decrement(n) => sub(store, n)
};
(([] : list(operation)), store)
};

View File

@ -6,7 +6,7 @@ type storage = michelson_pair
type return = (list(operation), storage);
let main =
((action, store): (unit, storage)): return =>
(((action, store): (unit, storage))): return =>
{
let foo = (3, (1, 2n));
(([] : list(operation)), (foo : storage))

View File

@ -1,6 +1,7 @@
let abcde_curried =
(a: int, b: int, c: int, d: int, e: int): int => c + e + 3;
((a: int), (b: int), (c: int), (d: int), (e: int)): int =>
c + e + 3;
let abcde =
(x: (int, int, int, int, int)): int =>
abcde_curried(x[0] x[1] x[2] x[3] x[4]);
((x: (int, int, int, int, int))): int =>
abcde_curried(x[0], x[1], x[2], x[3], x[4]);

View File

@ -13,7 +13,7 @@ type storage = {
auth: authorized_keys
};
type message = unit) => list(operation);
type message = (unit => list(operation));
type dummy = (key_hash, signature);
@ -30,28 +30,28 @@ type return = (list(operation), storage);
type parameter = CheckMessage(check_message_pt);
let check_message =
((param, s): (check_message_pt, storage)): return =>
(((param, s): (check_message_pt, storage))): return =>
{
let message: message = param[message];
let message: message = param.message;
let s =
if(param[counter]
!= s[counter]) {
if(param.counter
!= s.counter) {
(failwith("Counters does not match") : storage)
} else {
let packed_payload: bytes =
Bytes.pack((message, param[counter], s[id],
Bytes.pack((message, param.counter, s.id,
chain_id));
let valid: nat = 0n;
let keys: authorized_keys = s[auth];
let keys: authorized_keys = s.auth;
let aux =
((vk, pkh_sig):
((nat, authorized_keys), (key_hash, signature)))
(((vk, pkh_sig):
((nat, authorized_keys), (key_hash, signature))))
:
(nat, authorized_keys) =>
{
let (valid, keys) = vk;
let ((valid, keys)) = vk;
switch(keys) {
| [] => vk
| [key, ...keys] =>
@ -60,8 +60,8 @@ let check_message =
let valid =
if(
Crypto.check(key
pkh_sig[1]
Crypto.check(key,
pkh_sig[1],
packed_payload)) {
valid + 1n
} else {
@ -75,23 +75,23 @@ let check_message =
}
}
};
let (valid, keys) =
List.fold(aux param[signatures] (valid, keys));
let ((valid, keys)) =
List.fold(aux, param.signatures, (valid, keys));
if(valid
< s[threshold]) {
< s.threshold) {
(
failwith("Not enough signatures passed the check")
: storage)
} else {
{...s, counter: s[counter] + 1n}
{...s, counter: s.counter + 1n}
}
};
(message(unit), s)
};
let main =
((action, store): (parameter, storage)): return =>
(((action, store): (parameter, storage))): return =>
switch(action) {
| CheckMessagep => check_message((p, store))
| CheckMessage(p) => check_message((p, store))
};

View File

@ -1,7 +1,7 @@
type f = int;
let a =
(b: f) =>
((b: f)) =>
{
if(b
== 2) {
@ -12,7 +12,7 @@ let a =
};
let c =
(c: f) =>
((c: f)) =>
{
3
};

View File

@ -1,16 +1,16 @@
type storage = address;
type parameter = Donate(unit)
| Distribute((unit) => list(operation)));
| Distribute(((unit => list(operation))));
let donate =
((p, s): (unit, storage)): (list(operation), storage) =>
(((p, s): (unit, storage))): (list(operation), storage) =>
{
(([] : list(operation)), s)
};
let distribute =
((p, s): (unit) => list(operation), storage))
(((p, s): ((unit => list(operation)), storage)))
:
(list(operation), storage) =>
{
@ -26,7 +26,9 @@ let distribute =
};
let main =
((p, s): (parameter, storage)): (list(operation), storage) =>
(((p, s): (parameter, storage)))
:
(list(operation), storage) =>
{
switch(p) {
| Donate => donate(((), s))

View File

@ -1,36 +1,31 @@
type foobar = {foo: int, bar: int };
let fb: foobar = {foo = 0, bar = 0 };
let fb: foobar = {foo: 0, bar: 0 };
type abc = {a: int, b: int, c: int };
let abc: abc = {a = 42, b = 142, c = 242 };
let abc: abc = {a: 42, b: 142, c: 242 };
let a: int = abc[a];
let a: int = abc.a;
let b: int = abc[b];
let b: int = abc.b;
let c: int = abc[c];
let c: int = abc.c;
let projection = (r: foobar): int => r[foo] + r[bar];
let projection = ((r: foobar)): int => r.foo + r.bar;
let modify =
(r: foobar): foobar => {foo = 256, bar = r[bar] };
((r: foobar)): foobar => {foo: 256, bar: r.bar };
let modify_abc = (r: abc): abc => {...r, b: 2048, c: 42};
let modify_abc = ((r: abc)): abc => {...r, b: 2048, c: 42};
type big_record = {a: int, b: int, c: int, d: int, e: int };
let br: big_record =
{
a = 23,
b = 23,
c = 23,
d = 23,
e = 23
};
let br: big_record = {a: 23, b: 23, c: 23, d: 23, e: 23 };
type double_record = {inner: abc };
let modify_inner =
(r: double_record): double_record => {...r, inner.b: 2048};
((r: double_record)): double_record =>
{...r,
inner.b: 2048};

View File

@ -1,5 +1,5 @@
let rec sum =
((n, acc): (int, int)): int =>
(((n, acc): (int, int))): int =>
if(n
< 1) {
acc
@ -8,7 +8,7 @@ let rec sum =
};
let rec fibo =
((n, n_1, n_0): (int, int, int)): int =>
(((n, n_1, n_0): (int, int, int))): int =>
if(n
< 2) {
n_1

View File

@ -1 +1 @@
let main = (p: unit): address => Tezos.self_address;
let main = ((p: unit)): address => Tezos.self_address;

View File

@ -1,17 +1,18 @@
let literal_op =
(p: unit): set(string) =>
((p: unit)): set(string) =>
Set.literal(["foo", "bar", "foobar"]);
let add_op =
(s: set(string)): set(string) => Set.add("foobar" s);
((s: set(string))): set(string) => Set.add("foobar", s);
let remove_op =
(s: set(string)): set(string) => Set.remove("foobar" s);
((s: set(string))): set(string) => Set.remove("foobar", s);
let remove_deep =
(s: (set(string), nat)): set(string) =>
Set.remove("foobar" s[0]);
((s: (set(string), nat))): set(string) =>
Set.remove("foobar", s[0]);
let mem_op = (s: set(string)): bool => Set.mem("foobar" s);
let mem_op =
((s: set(string))): bool => Set.mem("foobar", s);
let size_op = (s: set(string)): nat => Set.cardinal(s);
let size_op = ((s: set(string))): nat => Set.cardinal(s);

View File

@ -1,5 +1,5 @@
let main =
(p: key_hash): list(operation) =>
((p: key_hash)): list(operation) =>
{
let unused: operation = (Tezos.set_delegate(Some (p)));
([] : list(operation))

View File

@ -1,3 +1,3 @@
type p = {x: int };
let o = (p: int): p => {x = p };
let o = ((p: int)): p => {x: p };

View File

@ -1,5 +1,6 @@
let size_op = (s: string): nat => String.length(s);
let size_op = ((s: string)): nat => String.length(s);
let slice_op = (s: string): string => String.sub(1n 2n s);
let slice_op =
((s: string)): string => String.sub(1n, 2n, s);
let concat_syntax = (s: string) => s ++ "test_literal";
let concat_syntax = ((s: string)) => s ++ "test_literal";

View File

@ -5,12 +5,12 @@ type storage = int;
type return = (list(operation), storage);
let main =
((action, store): (parameter, storage)): return =>
(((action, store): (parameter, storage))): return =>
{
let store =
switch(action) {
| Incrementn => store + n
| Decrementn => store - n
| Increment(n) => store + n
| Decrement(n) => store - n
};
([] : list(operation), store)
};

View File

@ -1,12 +1,12 @@
type abc = (int, int, int);
let projection_abc = (tpl: abc): int => tpl[1];
let projection_abc = ((tpl: abc)): int => tpl[1];
type foobar = (int, int);
let fb: foobar = (0, 0);
let projection = (tpl: foobar): int => tpl[0] + tpl[1];
let projection = ((tpl: foobar)): int => tpl[0] + tpl[1];
type big_tuple = (int, int, int, int, int);

View File

@ -1,4 +1,4 @@
let sum = ((result, i): (int, int)): int => result - i;
let sum = (((result, i): (int, int))): int => result - i;
let parentheses =
((result, i): (((int, int),),)): int => result - i;
((((((result, i)))): (((int, int))))): int => result - i;

View File

@ -1,48 +1,48 @@
type fun_type = (int, int) => int;
let arguments =
(b: int, c: int) =>
((b: int), (c: int)) =>
{
b + c
};
let arguments_type_def = (b: fun_type) => b(5 3);
let arguments_type_def = ((b: fun_type)) => b(5, 3);
let arguments_test =
(_: int) => arguments_type_def(arguments);
((_: int)) => arguments_type_def(arguments);
type tuple_type = (int, int)) => int;
type tuple_type = ((int, int) => int);
let tuple =
((a, b): (int, int)) =>
(((a, b): (int, int))) =>
{
a + b
};
let tuple_type_def = (b: tuple_type) => b((5, 3));
let tuple_type_def = ((b: tuple_type)) => b((5, 3));
let tuple_test = (_: int) => tuple_type_def(tuple);
let tuple_test = ((_: int)) => tuple_type_def(tuple);
let arguments_inline =
(b: int, c: int) =>
((b: int), (c: int)) =>
{
b + c
};
let arguments_type_def_inline =
(b: (int, int) => int) => b(5 3);
(b: (int, int) => int) => b(5, 3);
let arguments_test_inline =
(_: int) => arguments_type_def_inline(arguments_inline);
((_: int)) => arguments_type_def_inline(arguments_inline);
let tuple_inline =
((a, b): (int, int)) =>
(((a, b): (int, int))) =>
{
a + b
};
let tuple_type_def_inline =
(b: (int, int)) => int) => b((5, 3));
(b: ((int, int) => int)) => b((5, 3));
let tuple_test_inline =
(_: int) => tuple_type_def_inline(tuple_inline);
((_: int)) => tuple_type_def_inline(tuple_inline);

View File

@ -3,7 +3,7 @@ type storage = (int, string, nat, bool);
type parameter = int;
let main =
((p, storage): (parameter, storage)) =>
(((p, storage): (parameter, storage))) =>
{
([] : list(operation), (2, "2", 2n, false))
};

View File

@ -14,9 +14,9 @@ let g = (a + 1, c);
let h = ("a" ++ "2", d);
let i = (a: int, b: int) => a + b;
let i = ((a: int), (b: int)) => a + b;
let j = (a: int, b: int) => a - b;
let j = ((a: int), (b: int)) => a - b;
let m =
{
@ -24,13 +24,13 @@ let m =
z
};
let n = (a: int): int => a + 1;
let n = ((a: int)): int => a + 1;
let o = (a: int): int => a + 1;
let o = ((a: int)): int => a + 1;
let n = (a: int, b: int): int => a + 1;
let n = ((a: int), (b: int)): int => a + 1;
let o = (a: int, b: int): int => a + 1;
let o = ((a: int), (b: int)): int => a + 1;
let p =
{
@ -41,17 +41,17 @@ let p =
let q =
{
f = 3,
g = 6,
h = {i = "bla", j = 1 + 2, k = {l = 1, z = 2 } }
f: 3,
g: 6,
h: {i: "bla", j: 1 + 2, k: {l: 1, z: 2 } }
};
let s =
{
let a = 2;
{
z = a,
a = a
z: a,
a: a
}
};

View File

@ -2,17 +2,17 @@ type storage = int;
type parameter = Increment(int) | Decrement(int);
let add = ((a, b): (int, int)): int => a + b;
let add = (((a, b): (int, int))): int => a + b;
let sub = ((a, b): (int, int)): int => a - b;
let sub = (((a, b): (int, int))): int => a - b;
let main =
((p, storage): (parameter, storage)) =>
(((p, storage): (parameter, storage))) =>
{
let storage =
switch(p) {
| Incrementn => add((storage, n))
| Decrementn => sub((storage, n))
| Increment(n) => add((storage, n))
| Decrement(n) => sub((storage, n))
};
([] : list(operation), storage)
};