Fix some tests. Remove optimization of singleton tuples
This commit is contained in:
@@ -283,10 +283,13 @@ 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, [stateful,payable|Sys], [], [ArgT || {typed, _, _, ArgT} <- Args], {id, Sys, "void"}}
|
||||
|| {letfun, _, {id, _, "init"}, Args, _, _} <- Contents] of
|
||||
case [ [ArgT || {typed, _, _, ArgT} <- Args]
|
||||
|| {letfun, _, {id, _, "init"}, Args, _, _} <- Contents]
|
||||
++ [ Args || {fun_decl, _, {id, _, "init"}, {fun_t, _, _, Args, _}} <- Contents]
|
||||
++ [ Args || {fun_decl, _, {id, _, "init"}, {type_sig, _, _, _, Args, _}} <- Contents]
|
||||
of
|
||||
[] -> {fun_t, [stateful,payable|Sys], [], [], {id, Sys, "void"}};
|
||||
[T] -> T
|
||||
[Args] -> {fun_t, [stateful,payable|Sys], [], Args, {id, Sys, "void"}}
|
||||
end
|
||||
)
|
||||
}
|
||||
|
||||
@@ -715,14 +715,14 @@ expr_to_fcode(Env, Type, {app, _, Fun = {typed, _, FunE, {fun_t, _, NamedArgsT,
|
||||
case ArgsT of
|
||||
var_args -> fcode_error({var_args_not_set, FunE});
|
||||
_ ->
|
||||
FInitArgsT = {typerep, {tuple, [type_to_fcode(Env, T) || T <- ArgsT]}},
|
||||
FInitArgsT = aeb_fate_data:make_typerep({tuple, [type_to_fcode(Env, T) || T <- ArgsT]}),
|
||||
builtin_to_fcode(state_layout(Env), chain_clone, [{lit, FInitArgsT}|FArgs])
|
||||
end;
|
||||
{builtin_u, chain_create, _Ar} ->
|
||||
case {ArgsT, Type} of
|
||||
{var_args, _} -> fcode_error({var_args_not_set, FunE});
|
||||
{_, {con, _, Contract}} ->
|
||||
FInitArgsT = {typerep, {tuple, [type_to_fcode(Env, T) || T <- ArgsT]}},
|
||||
FInitArgsT = aeb_fate_data:make_typerep({tuple, [type_to_fcode(Env, T) || T <- ArgsT]}),
|
||||
builtin_to_fcode(state_layout(Env), chain_create, [{lit, {contract_code, Contract}}, {lit, FInitArgsT}|FArgs]);
|
||||
{_, _} -> fcode_error({not_a_contract_type, Type})
|
||||
end;
|
||||
|
||||
@@ -125,7 +125,6 @@ type_to_scode(bits) -> bits;
|
||||
type_to_scode(any) -> any;
|
||||
type_to_scode({variant, Cons}) -> {variant, [{tuple, types_to_scode(Con)} || Con <- Cons]};
|
||||
type_to_scode({list, Type}) -> {list, type_to_scode(Type)};
|
||||
type_to_scode({tuple, [Type]}) -> type_to_scode(Type);
|
||||
type_to_scode({tuple, Types}) -> {tuple, types_to_scode(Types)};
|
||||
type_to_scode({map, Key, Val}) -> {map, type_to_scode(Key), type_to_scode(Val)};
|
||||
type_to_scode({function, _Args, _Res}) -> {tuple, [string, any]};
|
||||
@@ -590,9 +589,6 @@ builtin_to_scode(Env, chain_create,
|
||||
[Code, TypeRep, Value | InitArgs]
|
||||
).
|
||||
|
||||
|
||||
|
||||
|
||||
%% -- Operators --
|
||||
|
||||
op_to_scode('+') -> aeb_fate_ops:add(?a, ?a, ?a);
|
||||
|
||||
Reference in New Issue
Block a user