Fix dialyzer warnings
This commit is contained in:
parent
fee2c574aa
commit
2ed9b1102a
@ -84,6 +84,11 @@
|
|||||||
|
|
||||||
-type field_constraint() :: #field_constraint{} | #record_create_constraint{} | #is_contract_constraint{}.
|
-type field_constraint() :: #field_constraint{} | #record_create_constraint{} | #is_contract_constraint{}.
|
||||||
|
|
||||||
|
-type byte_constraint() :: {is_bytes, utype()}
|
||||||
|
| {add_bytes, aeso_syntax:ann(), concat | split, utype(), utype(), utype()}.
|
||||||
|
|
||||||
|
-type constraint() :: named_argument_constraint() | field_constraint() | byte_constraint().
|
||||||
|
|
||||||
-record(field_info,
|
-record(field_info,
|
||||||
{ ann :: aeso_syntax:ann()
|
{ ann :: aeso_syntax:ann()
|
||||||
, field_t :: utype()
|
, field_t :: utype()
|
||||||
@ -2074,7 +2079,7 @@ when_option(Opt, Do) ->
|
|||||||
create_constraints() ->
|
create_constraints() ->
|
||||||
ets_new(constraints, [ordered_set]).
|
ets_new(constraints, [ordered_set]).
|
||||||
|
|
||||||
-spec add_constraint(byte_constraint() | named_argument_constraint() | field_constraint()) -> true.
|
-spec add_constraint(constraint() | [constraint()]) -> true.
|
||||||
add_constraint(Constraint) ->
|
add_constraint(Constraint) ->
|
||||||
ets_insert_ordered(constraints, Constraint).
|
ets_insert_ordered(constraints, Constraint).
|
||||||
|
|
||||||
@ -2113,9 +2118,11 @@ solve_constraints(Env) ->
|
|||||||
(_) -> true
|
(_) -> true
|
||||||
end,
|
end,
|
||||||
AmbiguousConstraints = lists:filter(IsAmbiguous, get_constraints()),
|
AmbiguousConstraints = lists:filter(IsAmbiguous, get_constraints()),
|
||||||
|
|
||||||
|
% The two passes on AmbiguousConstraints are needed
|
||||||
solve_ambiguous_constraints(Env, AmbiguousConstraints ++ AmbiguousConstraints).
|
solve_ambiguous_constraints(Env, AmbiguousConstraints ++ AmbiguousConstraints).
|
||||||
|
|
||||||
-spec solve_ambiguous_constraints(env(), [field_constraint() | named_argument_constraint() | byte_constraint()]) -> ok.
|
-spec solve_ambiguous_constraints(env(), [constraint()]) -> ok.
|
||||||
solve_ambiguous_constraints(Env, Constraints) ->
|
solve_ambiguous_constraints(Env, Constraints) ->
|
||||||
Unknown = solve_known_record_types(Env, Constraints),
|
Unknown = solve_known_record_types(Env, Constraints),
|
||||||
if Unknown == [] -> ok;
|
if Unknown == [] -> ok;
|
||||||
@ -2228,9 +2235,6 @@ specialize_dependent_type(Env, Type) ->
|
|||||||
|
|
||||||
%% -- Bytes constraints --
|
%% -- Bytes constraints --
|
||||||
|
|
||||||
-type byte_constraint() :: {is_bytes, utype()}
|
|
||||||
| {add_bytes, aeso_syntax:ann(), concat | split, utype(), utype(), utype()}.
|
|
||||||
|
|
||||||
solve_constraint(_Env, #field_constraint{record_t = {uvar, _, _}}) ->
|
solve_constraint(_Env, #field_constraint{record_t = {uvar, _, _}}) ->
|
||||||
not_solved;
|
not_solved;
|
||||||
solve_constraint(Env, C = #field_constraint{record_t = RecType,
|
solve_constraint(Env, C = #field_constraint{record_t = RecType,
|
||||||
@ -2358,7 +2362,7 @@ solve_unknown_record_types(Env, Unknown) ->
|
|||||||
false -> Solutions
|
false -> Solutions
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec solve_known_record_types(env(), [field_constraint() | named_argument_constraint() | byte_constraint()]) -> [field_constraint()].
|
-spec solve_known_record_types(env(), [constraint()]) -> [field_constraint()].
|
||||||
solve_known_record_types(Env, Constraints) ->
|
solve_known_record_types(Env, Constraints) ->
|
||||||
DerefConstraints = lists:map(fun(C = #field_constraint{record_t = RecordType}) ->
|
DerefConstraints = lists:map(fun(C = #field_constraint{record_t = RecordType}) ->
|
||||||
C#field_constraint{record_t = dereference(RecordType)};
|
C#field_constraint{record_t = dereference(RecordType)};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user