Hello<br><br>I found incomprehensible thing in dialyzer's output for MatchSpec using records.<br><br>This is my module:<br>=======================================<br>-module(loc).<br>-export([get_ctrl_good/1, get_ctrl_bad/1]).<br>
<br>-record(controller, {<br>          id :: integer(),<br>          address :: any(),<br>          type :: any(),<br>          name :: string(),<br>          profile :: integer()<br>         }).<br><br>get_ctrl_good(CtrlId) -><br>
    CtrlMS = [{#controller{id = CtrlId, _='_'}, [], ['$_']}],<br>    case mnesia:dirty_select(controller, CtrlMS) of<br>        [Controller] -> [Controller];<br>        _ -> not_found<br>    end.<br>
<br>get_ctrl_bad(CtrlId) -><br>    CtrlMS = [{#controller{id = CtrlId}, [], ['$_']}],<br>    case mnesia:dirty_select(controller, CtrlMS) of<br>        [Controller] -> [Controller];<br>        _ -> not_found<br>
    end.<br>=======================================<br><br>So, when I make dialyzer --src -c loc.erl, I see following output:<br><br>>>>>>>><br>  Checking whether the PLT /home/zert/.dialyzer_plt is up-to-date... yes<br>
  Proceeding with analysis...<br>loc.erl:13: Function get_ctrl_good/1 has no local return<br>loc.erl:14: Record construction #controller{id::any(),address::'_',type::'_',name::'_',profile::'_'} violates the declared type for #controller{}<br>
 done in 0m0.59s<br>done (warnings were emitted)<br>>>>>>>><br><br>get_ctrl_bad/1 not contains _='_' in MatchSpec for dirty_select query and does not work due to unassignet fileds of record became to undefined value.<br>
get_ctrl_good/1 works fine, but dialyzer not think so.<br>BTW, I know about ets:ms2fun, it gave me same results as in get_ctrl_good/1<br><br>My OTP release is R12B-5.<br><br>How I can make this code right?<br><br>Thank you<br clear="all">
<br>-- <br>Maxim Treskin<br>