<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi,<div><br></div><div>I’d recommend you to decouple the type spec from the record the following way:</div><div><br></div><div><font face="Menlo">-record(kv, {key, value}).</font></div><div><font face="Menlo">-type kv() :: #kv{key::string(), value::integer()}.</font></div><div><br></div><div>Bonus feature: you can export the kv/0 type from your module (if you need to), but you can’t do that when the types are embedded into the record declaration.</div><div><br></div><div>Regards,</div><div>Daniel</div><div><br></div><div><div><div>On 2014 Apr 18, at 11:40 , Solomon <<a href="mailto:solomon.wzs@gmail.com">solomon.wzs@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi.<br><br>I declared a record like this:<br>-record(kv, {key::string(), value::integer()}).<br><br>and I create a mnesia table to save the record 'kv'<br><br>I select the table like this:<br>mnesia:dirty_select(table, [{#kv{key='_', value='$1'}, [{'>', '$1',<br>10}], ['_']}]).<br><br>then I analysis the code:<br>dialyzer --plt ./.depsolver_plt ./ebin/my.beam<br><br>and I get the error:<br>Record construction #kv{key::'_', value::'$1'} violates the declared<br>type of field key::string() and value::integer()<br><br>How should I fix the error?<br><br>Thanks.<br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br></div></body></html>