Jump some hoops to please Dialyzer
This commit is contained in:
parent
519850e1fd
commit
a2b762c066
@ -80,6 +80,7 @@
|
|||||||
|
|
||||||
-type ftype() :: integer
|
-type ftype() :: integer
|
||||||
| boolean
|
| boolean
|
||||||
|
| string
|
||||||
| {list, ftype()}
|
| {list, ftype()}
|
||||||
| {map, ftype(), ftype()}
|
| {map, ftype(), ftype()}
|
||||||
| {tuple, [ftype()]}
|
| {tuple, [ftype()]}
|
||||||
@ -268,7 +269,7 @@ decl_to_fcode(Env = #{ functions := Funs }, {letfun, Ann, {id, _, Name}, Args, R
|
|||||||
NewFuns = Funs#{ FName => Def },
|
NewFuns = Funs#{ FName => Def },
|
||||||
Env#{ functions := NewFuns }.
|
Env#{ functions := NewFuns }.
|
||||||
|
|
||||||
-spec typedef_to_fcode(env(), aeso_syntax:id(), [aeso_syntax:tvar()], aeso_syntax:type_def()) -> env().
|
-spec typedef_to_fcode(env(), aeso_syntax:id(), [aeso_syntax:tvar()], aeso_syntax:typedef()) -> env().
|
||||||
typedef_to_fcode(Env, {id, _, Name}, Xs, Def) ->
|
typedef_to_fcode(Env, {id, _, Name}, Xs, Def) ->
|
||||||
Q = qname(Env, Name),
|
Q = qname(Env, Name),
|
||||||
FDef = fun(Args) ->
|
FDef = fun(Args) ->
|
||||||
@ -659,8 +660,9 @@ pat_to_fcode(Env, Pat) ->
|
|||||||
|
|
||||||
-spec pat_to_fcode(env(), aeso_syntax:type() | no_type, aeso_syntax:pat()) -> fpat().
|
-spec pat_to_fcode(env(), aeso_syntax:type() | no_type, aeso_syntax:pat()) -> fpat().
|
||||||
pat_to_fcode(_Env, _Type, {id, _, X}) -> {var, X};
|
pat_to_fcode(_Env, _Type, {id, _, X}) -> {var, X};
|
||||||
pat_to_fcode(Env, Type, {C, _, _} = Con) when C == con; C == qcon ->
|
pat_to_fcode(Env, _Type, {C, _, _} = Con) when C == con; C == qcon ->
|
||||||
pat_to_fcode(Env, Type, {app, [], {typed, [], Con, Type}, []});
|
#con_tag{tag = I, arities = As} = lookup_con(Env, Con),
|
||||||
|
{con, As, I, []};
|
||||||
pat_to_fcode(Env, _Type, {app, _, {typed, _, {C, _, _} = Con, _}, Pats}) when C == con; C == qcon ->
|
pat_to_fcode(Env, _Type, {app, _, {typed, _, {C, _, _} = Con, _}, Pats}) when C == con; C == qcon ->
|
||||||
#con_tag{tag = I, arities = As} = lookup_con(Env, Con),
|
#con_tag{tag = I, arities = As} = lookup_con(Env, Con),
|
||||||
{con, As, I, [pat_to_fcode(Env, Pat) || Pat <- Pats]};
|
{con, As, I, [pat_to_fcode(Env, Pat) || Pat <- Pats]};
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
| switch_body
|
| switch_body
|
||||||
| tuple(). %% FATE instruction
|
| tuple(). %% FATE instruction
|
||||||
|
|
||||||
-type arg() :: aeb_fate_code:fate_arg().
|
-type arg() :: tuple(). %% Not exported: aeb_fate_code:fate_arg().
|
||||||
|
|
||||||
%% Annotated scode
|
%% Annotated scode
|
||||||
-type scode_a() :: [sinstr_a()].
|
-type scode_a() :: [sinstr_a()].
|
||||||
@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
debug(Tag, Options, Fmt, Args) ->
|
debug(Tag, Options, Fmt, Args) ->
|
||||||
Tags = proplists:get_value(debug, Options, []),
|
Tags = proplists:get_value(debug, Options, []),
|
||||||
case Tags == all orelse lists:member(Tag, Tags) orelse Tag == any andalso Tags /= [] of
|
case Tags == all orelse lists:member(Tag, Tags) of
|
||||||
true -> io:format(Fmt, Args);
|
true -> io:format(Fmt, Args);
|
||||||
false -> ok
|
false -> ok
|
||||||
end.
|
end.
|
||||||
@ -185,7 +185,7 @@ to_scode(_Env, {lit, L}) ->
|
|||||||
{account_pubkey, K} -> [push(?i(aeb_fate_data:make_address(K)))];
|
{account_pubkey, K} -> [push(?i(aeb_fate_data:make_address(K)))];
|
||||||
{contract_pubkey, K} -> [push(?i(aeb_fate_data:make_address(K)))];
|
{contract_pubkey, K} -> [push(?i(aeb_fate_data:make_address(K)))];
|
||||||
{oracle_pubkey, K} -> [push(?i(aeb_fate_data:make_oracle(K)))];
|
{oracle_pubkey, K} -> [push(?i(aeb_fate_data:make_oracle(K)))];
|
||||||
{oracle_query_id, K} -> [push(?i(aeb_fate_data:make_oracle_query(K)))] %% TODO: Not actually in FATE yet
|
{oracle_query_id, _} -> ?TODO(fate_oracle_query_id_value)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
to_scode(_Env, nil) ->
|
to_scode(_Env, nil) ->
|
||||||
@ -743,9 +743,10 @@ var_writes(I) ->
|
|||||||
_ -> []
|
_ -> []
|
||||||
end.
|
end.
|
||||||
|
|
||||||
independent({switch, _, _, _, _}, _) -> false;
|
-spec independent(sinstr_a(), sinstr_a()) -> boolean().
|
||||||
|
%% independent({switch, _, _, _, _}, _) -> false; %% Commented due to Dialyzer whinging
|
||||||
independent(_, {switch, _, _, _, _}) -> false;
|
independent(_, {switch, _, _, _, _}) -> false;
|
||||||
independent(switch_body, _) -> true;
|
%% independent(switch_body, _) -> true;
|
||||||
independent(_, switch_body) -> true;
|
independent(_, switch_body) -> true;
|
||||||
independent({i, _, I}, {i, _, J}) ->
|
independent({i, _, I}, {i, _, J}) ->
|
||||||
#{ write := WI, read := RI, pure := PureI } = attributes(I),
|
#{ write := WI, read := RI, pure := PureI } = attributes(I),
|
||||||
@ -768,7 +769,7 @@ merge_ann(#{ live_in := LiveIn }, #{ live_out := LiveOut }) ->
|
|||||||
|
|
||||||
%% Swap two instructions. Precondition: the instructions are independent/2.
|
%% Swap two instructions. Precondition: the instructions are independent/2.
|
||||||
swap_instrs(I, switch_body) -> {switch_body, I};
|
swap_instrs(I, switch_body) -> {switch_body, I};
|
||||||
swap_instrs(switch_body, I) -> {I, switch_body};
|
%% swap_instrs(switch_body, I) -> {I, switch_body}; %% Commented due to Dialyzer whinging
|
||||||
swap_instrs({i, #{ live_in := Live1 }, I}, {i, #{ live_in := Live2, live_out := Live3 }, J}) ->
|
swap_instrs({i, #{ live_in := Live1 }, I}, {i, #{ live_in := Live2, live_out := Live3 }, J}) ->
|
||||||
%% Since I and J are independent the J can't read or write anything in
|
%% Since I and J are independent the J can't read or write anything in
|
||||||
%% that I writes.
|
%% that I writes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user