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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 addresses #921. /cc @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
borshop
added a commit
that referenced
this pull request
Apr 22, 2014
Fix some AAE dialyzer errors Reviewed-by: reiddraper
@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
@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
@borshop merge por favor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 wasto fix the spec for
#index_info.repaired
which is actually a#simple_stat{}
not apos_integer()
. However, even after thatdialyzer 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 discussedin 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: