basho/riak_kv — pull request #924 by rzezeski (2014-04-22 15:32:47+00:00)
Title: Fix some AAE dialyzer errors

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 can never
match the type <'undefined' | pos_integer(),pos_integer()>
riak_kv_entropy_info.erl:227: The pattern 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
```