[erlang-questions] Dialyzer warning on pattern match with sub-record

Stavros Aronis aronisstav@REDACTED
Thu Mar 30 10:53:10 CEST 2017


Hi Russell,

>From your original warning:

On Thu, Mar 30, 2017 at 9:04 AM, Russell Brown <russell@REDACTED> wrote:

> riak_kv_vnode.erl:2695: Matching of pattern State = {'state', _, _, _, _,
> _, VId, _, _, _, _, _, _, _, _, _, _, _, _, _, {'counter_state', 'false',
> _, _, _, _}, _, _} tagged with a record name violates the declared type of
> #state{idx::'undefined' | integer(),mod::atom() |
> tuple(),async_put::'false' | 'true' | 'undefined',vnodeid::'undefined' |
> binary(),delete_mode::'immediate' | 'keep' | 'undefined' |
> pos_integer(),bucket_buf_size::'undefined' |
> pos_integer(),index_buf_size::'undefined' | pos_integer(),key_buf_size::'undefined'
> | pos_integer(),async_folding::'false' | 'true' | 'undefined',in_handoff::
> boolean(),handoff_target::atom(),handoffs_rejected::integer(),forward::atom()
> | [{integer(),atom()}],hashtrees::'undefined' | pid(),upgrade_hashtree::boolean(),md_cache::atom()
> | tid(),md_cache_size::'undefined' | pos_integer(),counter::'undefined' |
> #counter_state{use::'true',cnt::non_neg_integer(),lease::
> non_neg_integer(),lease_size::non_neg_integer(),leasing::
> boolean()},status_mgr_pid::'undefined' | pid(),update_hook::atom() |
> tuple()}
>   riak_object:object/0
>

my guess would be that in the definition of the #state record, the
annotated #state.counter field's type is a #counter_state record whose
#counter_state.use field annotated type is just the atom 'true'.

Can you send some context from that part of the module? (e.g. definition of
#state and #counter_state records)

Best,

Stavros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170330/cf288480/attachment.htm>


More information about the erlang-questions mailing list