Merge pull request #273 from aeternity/GH272-singleton_record_calldata_decode
Fix singleton record calldata decode + test
This commit is contained in:
commit
ed5447e430
@ -95,6 +95,8 @@ from_fate({tuple_t, _, Types}, ?FATE_TUPLE(Val))
|
|||||||
when length(Types) == tuple_size(Val) ->
|
when length(Types) == tuple_size(Val) ->
|
||||||
{tuple, [], [from_fate(Type, X)
|
{tuple, [], [from_fate(Type, X)
|
||||||
|| {Type, X} <- lists:zip(Types, tuple_to_list(Val))]};
|
|| {Type, X} <- lists:zip(Types, tuple_to_list(Val))]};
|
||||||
|
from_fate({record_t, [{field_t, _, FName, FType}]}, Val) ->
|
||||||
|
{record, [], [{field, [], [{proj, [], FName}], from_fate(FType, Val)}]};
|
||||||
from_fate({record_t, Fields}, ?FATE_TUPLE(Val))
|
from_fate({record_t, Fields}, ?FATE_TUPLE(Val))
|
||||||
when length(Fields) == tuple_size(Val) ->
|
when length(Fields) == tuple_size(Val) ->
|
||||||
{record, [], [ {field, [], [{proj, [], FName}], from_fate(FType, X)}
|
{record, [], [ {field, [], [{proj, [], FName}], from_fate(FType, X)}
|
||||||
|
@ -113,6 +113,7 @@ compilable_contracts() ->
|
|||||||
{"funargs", "traffic_light", ["Pantone(12)"]},
|
{"funargs", "traffic_light", ["Pantone(12)"]},
|
||||||
{"funargs", "tuples", ["()"]},
|
{"funargs", "tuples", ["()"]},
|
||||||
%% TODO {"funargs", "due", ["FixedTTL(1020)"]},
|
%% TODO {"funargs", "due", ["FixedTTL(1020)"]},
|
||||||
|
{"funargs", "singleton_rec", ["{x = 1000}"]},
|
||||||
{"variant_types", "init", []},
|
{"variant_types", "init", []},
|
||||||
{"basic_auth", "init", []},
|
{"basic_auth", "init", []},
|
||||||
{"address_literals", "init", []},
|
{"address_literals", "init", []},
|
||||||
|
@ -45,3 +45,8 @@ contract FunctionArguments =
|
|||||||
|
|
||||||
entrypoint due(t : Chain.ttl) =
|
entrypoint due(t : Chain.ttl) =
|
||||||
true
|
true
|
||||||
|
|
||||||
|
record singleton_r = { x : int }
|
||||||
|
|
||||||
|
entrypoint singleton_rec(r : singleton_r) =
|
||||||
|
r.x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user