basho/riak_core — pull request #540 by seancribbs (2014-02-28 21:41:59+00:00)
Title: Fix dialyzer warnings

This is a rebase/cleanup of #528. As agreed with @jrwest, this *does not* include removal of legacy gossip, which will be in a separate PR. Also, warnings from `riak_core_security` are left alone until fixes land from @Vagabond and @macintux.

There should be no eunit failures on this branch, but these warnings *should* exist:

```
# These are legacy gossip warnings:
riak_core.erl:85: The pattern 'true' can never match the type 'false'
riak_core.erl:185: The pattern 'true' can never match the type 'false'
riak_core.erl:203: The pattern <'true', _> can never match the type <'false',_>
riak_core.erl:239: The pattern 'true' can never match the type 'false'
riak_core.erl:262: Function legacy_remove/1 will never be called
riak_core_claimant.erl:366: The pattern 'legacy' can never match the type {'error','invalid_resize_claim'} | {'ok',[{_,_},...]}
riak_core_claimant.erl:403: The pattern {'legacy', _} can never match the type {'error','invalid_resize_claim'} | {'ok',{'chstate_v2',_,'undefined' | [any()],{_,_},'undefined' | dict(),'undefined' | {_,_},'undefined' | [any()],[any()],_,'undefined' | [any()],'undefined' | [any()]}}
riak_core_claimant.erl:797: The pattern {'legacy', _} can never match the type {'error','invalid_resize_claim'} | {'ok',{'chstate_v2',_,'undefined' | [any()],{_,_},'undefined' | dict(),'undefined' | {_,_},'undefined' | [any()],[any()],_,'undefined' | [any()],'undefined' | [any()]}}
riak_core_claimant.erl:825: The pattern {'true', 'true'} can never match the type {'true','false'}
riak_core_console.erl:102: The pattern 'true' can never match the type 'false'
riak_core_console.erl:918: The variable Error can never match since previous clauses completely covered the type 'ok'
riak_core_gossip.erl:214: The pattern 1 can never match the type 2
riak_core_gossip.erl:229: The pattern 'true' can never match the type 'false'
riak_core_gossip.erl:245: The pattern 'true' can never match the type 'false'
riak_core_ring_handler.erl:73: The pattern {'true', _, _, _} can never match the type {'false',boolean(),[integer()],'down' | 'exiting' | 'invalid' | 'joining' | 'leaving' | 'valid'}

# These are security warnings:
riak_core_security.erl:252: The test [any()] == 'all' can never evaluate to 'true'
riak_core_security.erl:265: The test [any()] == 'all' can never evaluate to 'true'
riak_core_security.erl:488: The call riak_core_security:add_grant_int(['all'],Bucket::any(),Grants::maybe_improper_list()) will never return since it differs in the 1st argument from the success typing arguments: ([{_,'group' | 'user'}],any(),maybe_improper_list())
riak_core_security.erl:530: The call riak_core_security:add_revoke_int(['all'],Bucket::any(),'revokes') will never return since it differs in the 1st argument from the success typing arguments: ([{_,'group' | 'user'}],any(),'revokes' | maybe_improper_list())
riak_core_security.erl:533: The variable Error2 can never match since previous clauses completely covered the type 'ok'
riak_core_security.erl:882: The variable Error can never match since previous clauses completely covered the type {'ok',[tuple(),...]}
riak_core_security.erl:917: The pattern {'error', Error} can never match the type {'ok',binary() | [1..255],'pbkdf2','sha',binary(),65536}
```