From 5c43be22b9ebda27bd9ce0b910d7ec86c55e9523 Mon Sep 17 00:00:00 2001 From: radrow Date: Mon, 10 May 2021 16:17:53 +0200 Subject: [PATCH] cleanup --- src/aeso_ast_infer_types.erl | 8 ++++++-- src/aeso_ast_to_fcode.erl | 1 - src/aeso_fcode_to_fate.erl | 1 - test/aeso_compiler_tests.erl | 4 +--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index fcb30a2..88e7e43 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -283,9 +283,9 @@ bind_contract({Contract, Ann, Id, Contents}, Env) [ {field_t, Sys, {id, Sys, "address"}, {id, Sys, "address"}} ] ++ [ {field_t, Sys, {id, Sys, ?CONSTRUCTOR_MOCK_NAME}, contract_call_type( - case [ {fun_t, [payable|Sys], [], [ArgT || {typed, _, _, ArgT} <- Args], {id, Sys, "void"}} + case [ {fun_t, [stateful,payable|Sys], [], [ArgT || {typed, _, _, ArgT} <- Args], {id, Sys, "void"}} || {letfun, _, {id, _, "init"}, Args, _, _} <- Contents] of - [] -> {fun_t, [payable|Sys], [], [], {id, Sys, "void"}}; + [] -> {fun_t, [stateful,payable|Sys], [], [], {id, Sys, "void"}}; [T] -> T end ) @@ -3092,6 +3092,10 @@ pp_why_record(Fld = {field, _Ann, LV, _E}) -> {pos(Fld), io_lib:format("arising from an assignment of the field ~s (at ~s)", [pp_expr("", {lvalue, [], LV}), pp_loc(Fld)])}; +pp_why_record(Fld = {field, _Ann, LV, _Alias, _E}) -> + {pos(Fld), + io_lib:format("arising from an assignment of the field ~s (at ~s)", + [pp_expr("", {lvalue, [], LV}), pp_loc(Fld)])}; pp_why_record({proj, _Ann, Rec, FldName}) -> {pos(Rec), io_lib:format("arising from the projection of the field ~s (at ~s)", diff --git a/src/aeso_ast_to_fcode.erl b/src/aeso_ast_to_fcode.erl index 11aa761..54db9e0 100644 --- a/src/aeso_ast_to_fcode.erl +++ b/src/aeso_ast_to_fcode.erl @@ -707,7 +707,6 @@ expr_to_fcode(Env, _Type, {app, _Ann, {Op, _}, [A]}) when is_atom(Op) -> %% Function calls expr_to_fcode(Env, Type, {app, _, Fun = {typed, _, FunE, {fun_t, _, NamedArgsT, ArgsT, _}}, Args}) -> - io:format("Named args: ~p\n", [[N||{named_arg_t, _, {id, _, N}, _, _} <- NamedArgsT]]), Args1 = get_named_args(NamedArgsT, Args), FArgs = [expr_to_fcode(Env, Arg) || Arg <- Args1], case expr_to_fcode(Env, Fun) of diff --git a/src/aeso_fcode_to_fate.erl b/src/aeso_fcode_to_fate.erl index ba548f5..ba4ade7 100644 --- a/src/aeso_fcode_to_fate.erl +++ b/src/aeso_fcode_to_fate.erl @@ -328,7 +328,6 @@ to_scode1(Env, {remote, ArgsT, RetT, Ct, Fun, [Gas, Value, Protected | Args]}) - {ArgTypes, RetType0} = typesig_to_scode([{"_", T} || T <- ArgsT], RetT), ArgType = ?i(aeb_fate_data:make_typerep({tuple, ArgTypes})), RetType = ?i(aeb_fate_data:make_typerep(RetType0)), - io:format("GAS: ~p, VALUE: ~p, PROT: ~p\n", [Gas, Value, Protected]), case Protected of {lit, {bool, false}} -> case Gas of diff --git a/test/aeso_compiler_tests.erl b/test/aeso_compiler_tests.erl index e7bbd97..feb75d2 100644 --- a/test/aeso_compiler_tests.erl +++ b/test/aeso_compiler_tests.erl @@ -26,14 +26,13 @@ run_test(Test) -> simple_compile_test_() -> [ {"Testing the " ++ ContractName ++ " contract with the " ++ atom_to_list(Backend) ++ " backend", fun() -> - case compile(Backend, ContractName, [pp_assembler]) of + case compile(Backend, ContractName) of #{byte_code := ByteCode, contract_source := _, type_info := _} when Backend == aevm -> ?assertMatch(Code when is_binary(Code), ByteCode); #{fate_code := Code} when Backend == fate -> Code1 = aeb_fate_code:deserialize(aeb_fate_code:serialize(Code)), - error(xd), ?assertMatch({X, X}, {Code1, Code}); ErrBin -> io:format("\n~s", [ErrBin]), @@ -208,7 +207,6 @@ debug_mode_contracts() -> -define(TYPE_ERROR(Name, Errs), ?ERROR("Type", Name, Errs)). -define(PARSE_ERROR(Name, Errs), ?ERROR("Parse", Name, Errs)). -failing_contracts() -> []; % FIXME remove failing_contracts() -> {ok, V} = aeso_compiler:numeric_version(), Version = list_to_binary(string:join([integer_to_list(N) || N <- V], ".")),