Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some AAE dialyzer errors #924

Merged
merged 1 commit into from May 14, 2014
Merged

Conversation

rzezeski
Copy link
Contributor

This commit fixes all the dialyzer errors for riak_kv_entropy_info
as well as an error for riak_kv_exchange_fsm. The main change was
to fix the spec for #index_info.repaired which is actually a
#simple_stat{} not a pos_integer(). However, even after that
dialyzer was not happy with the explicit default values of undefined
without corresponding entries in the type definition. This seemed like
a waste to me given that Erlang will implicitly default records values
to undefined and insert the appropriate type spec. This is discussed
in the following reference manual:

http://www.erlang.org/doc/reference_manual/typespec.html#typeinrecords

Here is the full list of dialyzer errors which have been fixed:

riak_kv_entropy_info.erl:78: Function exchange_complete/4 has no local
return
riak_kv_entropy_info.erl:83: Function exchange_complete/5 has no local
return
riak_kv_entropy_info.erl:84: The call
riak_kv_entropy_info:update_index_info({_,_},{'exchange_complete',_,_,_})
will never return since it differs in the 2nd argument fr
riak_kv_entropy_info.erl:161: Record construction
repaired::pos_integer() and last_exchange::{non_neg_inte
riak_kv_entropy_info.erl:194: The call
riak_kv_entropy_info:update_simple_stat(Repaired::'undefined' |
pos_integer(),pos_integer()) will never return since it differs in
riak_kv_entropy_info.erl:208: Function compute_exchange_info/4 has no
local return
riak_kv_entropy_info.erl:218: The call
riak_kv_entropy_info:stat_tuple(Repaired::pos_integer()) will never
return since it differs in the 1st argument from the success t
riak_kv_entropy_info.erl:225: Function update_simple_stat/2 has no local
return
riak_kv_entropy_info.erl:225: The pattern <Value, 'undefined'> can never
match the type <'undefined' | pos_integer(),pos_integer()>
riak_kv_entropy_info.erl:227: The pattern <Value, Stat = {'simple_stat',
_, Min, Max, Cnt, Sum}> can never match the type <'undefined' |
pos_integer(),pos_integer()>
riak_kv_entropy_info.erl:234: Function stat_tuple/1 has no local return
riak_kv_entropy_info.erl:234: The pattern 'undefined' can never match
the type pos_integer()
riak_kv_entropy_info.erl:236: The pattern {'simple_stat', Last, Min,
Max, Cnt, Sum} can never match the type pos_integer()
riak_kv_exchange_fsm.erl:379: Function exchange_complete/4 has no local
return

This commit fixes all the dialyzer errors for `riak_kv_entropy_info`
as well as an error for `riak_kv_exchange_fsm`.  The main change was
to fix the spec for `#index_info.repaired` which is actually a
`#simple_stat{}` not a `pos_integer()`. However, even after that
dialyzer was not happy with the explicit default values of `undefined`
without corresponding entries in the type definition. This seemed like
a waste to me given that Erlang will implicitly default records values
to `undefined` and insert the appropriate type spec. This is discussed
in the following reference manual:

http://www.erlang.org/doc/reference_manual/typespec.html#typeinrecords

Here is the full list of dialyzer errors which have been fixed:

```
riak_kv_entropy_info.erl:78: Function exchange_complete/4 has no local
return
riak_kv_entropy_info.erl:83: Function exchange_complete/5 has no local
return
riak_kv_entropy_info.erl:84: The call
riak_kv_entropy_info:update_index_info({_,_},{'exchange_complete',_,_,_})
will never return since it differs in the 2nd argument fr
riak_kv_entropy_info.erl:161: Record construction
repaired::pos_integer() and last_exchange::{non_neg_inte
riak_kv_entropy_info.erl:194: The call
riak_kv_entropy_info:update_simple_stat(Repaired::'undefined' |
pos_integer(),pos_integer()) will never return since it differs in
riak_kv_entropy_info.erl:208: Function compute_exchange_info/4 has no
local return
riak_kv_entropy_info.erl:218: The call
riak_kv_entropy_info:stat_tuple(Repaired::pos_integer()) will never
return since it differs in the 1st argument from the success t
riak_kv_entropy_info.erl:225: Function update_simple_stat/2 has no local
return
riak_kv_entropy_info.erl:225: The pattern <Value, 'undefined'> can never
match the type <'undefined' | pos_integer(),pos_integer()>
riak_kv_entropy_info.erl:227: The pattern <Value, Stat = {'simple_stat',
_, Min, Max, Cnt, Sum}> can never match the type <'undefined' |
pos_integer(),pos_integer()>
riak_kv_entropy_info.erl:234: Function stat_tuple/1 has no local return
riak_kv_entropy_info.erl:234: The pattern 'undefined' can never match
the type pos_integer()
riak_kv_entropy_info.erl:236: The pattern {'simple_stat', Last, Min,
Max, Cnt, Sum} can never match the type pos_integer()
riak_kv_exchange_fsm.erl:379: Function exchange_complete/4 has no local
return
```
@rzezeski
Copy link
Contributor Author

This addresses #921.

/cc @reiddraper

@rzezeski rzezeski added this to the 2.0-RC milestone Apr 22, 2014
borshop added a commit that referenced this pull request Apr 22, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
borshop added a commit that referenced this pull request Apr 22, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
borshop added a commit that referenced this pull request Apr 22, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
@reiddraper
Copy link
Contributor

@borshop: retry yet again please and thank you

borshop added a commit that referenced this pull request May 12, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
borshop added a commit that referenced this pull request May 12, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
borshop added a commit that referenced this pull request May 12, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
@kellymclaughlin
Copy link
Contributor

@borshop: retry

borshop added a commit that referenced this pull request May 13, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
borshop added a commit that referenced this pull request May 14, 2014
Fix some AAE dialyzer errors

Reviewed-by: reiddraper
@reiddraper
Copy link
Contributor

@borshop merge por favor

@borshop borshop merged commit 5ea1dbb into develop May 14, 2014
@reiddraper reiddraper deleted the rz/entropy-info-dialyzer-fixes branch May 14, 2014 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants