[erlang-questions] the record volates the declared type when I analysis the code

Loïc Hoguin essen@REDACTED
Fri Apr 18 12:00:04 CEST 2014


You defined key to be a string() and value to be integer() and then pass 
a #kv{} record with key being an atom() and value being another atom(), 
so Dialyzer of course complains, your types are incorrect and/or incomplete.

On 04/18/2014 11:40 AM, Solomon wrote:
> Hi.
>
> I declared a record like this:
> -record(kv, {key::string(), value::integer()}).
>
> and I create a mnesia table to save the record 'kv'
>
> I select the table like this:
> mnesia:dirty_select(table, [{#kv{key='_', value='$1'}, [{'>', '$1',
> 10}], ['_']}]).
>
> then I analysis the code:
> dialyzer --plt ./.depsolver_plt ./ebin/my.beam
>
> and I get the error:
> Record construction #kv{key::'_', value::'$1'} violates the declared
> type of field key::string() and value::integer()
>
> How should I fix the error?
>
> Thanks.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list