<div dir="ltr">Hi,<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">Whilst R15B03 prevents you from redefine the mfa() built-in type:</span><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>R15$ erlc recon_trace.erl </div><div>recon_trace.erl:182: type mfa() is a builtin type; it cannot be redefined</div><div><br></div><div>R16 doesn't complain at all and allows the type to be redefined.</div>
<div><br></div><div>Is this intentional? I looked at erl_lint in both Erlang versions and, even if mfa/0 seems to be defined as a default type in both cases, the type_def function behaves very differently in the two Erlang versions. Looking at the dict:is_key/2 function called as part of the top-level case in the type_def function you get:</div>
<div><br></div><div>R15B03:</div><div><br></div></div></div><div><div>$ erlc recon_trace.erl </div><div>(<0.25.0>) call dict:is_key({mfa,0},{dict,67,16,16,8,80,48,</div><div> {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},</div>
<div> {{[[{boolean,0}|-1],</div><div> [{'fun',0}|-1],</div><div> [{function,0}|-1],</div><div> [{no_return,0}|-1],</div><div> [{shellfun,0},{line,{"recon_trace.erl",165}}],</div>
<div> [{fn,0},{line,{"recon_trace.erl",180}}]],</div><div> [],</div><div> [[{'fun',2}|-1]],</div><div> [[{iodata,0}|-1],[{mfa,0}|-1]],</div><div> [[{char,0}|-1],</div>
<div> [{identifier,0}|-1],</div><div> [{integer,0}|-1],</div><div> [{neg_integer,0}|-1],</div><div> [{non_neg_integer,0}|-1],</div><div> [{number,0}|-1],</div><div> [{pos_integer,0}|-1]],</div>
<div> [[{matchspec,0},{line,{"recon_trace.erl",164}}],</div><div> [{millisecs,0},{line,{"recon_trace.erl",166}}],</div><div> [{pidspec,0},{line,{"recon_trace.erl",167}}],</div>
<div> [{max_traces,0},{line,{"recon_trace.erl",168}}],</div><div> [{options,0},{line,{"recon_trace.erl",172}}],</div><div> [{args,0},{line,{"recon_trace.erl",181}}],</div>
<div> [{num_matches,0},{line,{"recon_trace.erl",183}}]],</div><div> [[{dict,0}|-1],</div><div> [{float,0}|-1],</div><div> [{gb_set,0}|-1],</div><div> [{iolist,0}|-1],</div>
<div> [{list,0}|-1],</div><div> [{maybe_improper_list,0}|-1],</div><div> [{nonempty_list,0}|-1],</div><div> [{nonempty_maybe_improper_list,0}|-1],</div><div> [{pid,0}|-1],</div><div>
[{port,0}|-1],</div><div> [{set,0}|-1],</div><div> [{timeout,0}|-1],</div><div> [{mod,0},{line,{"recon_trace.erl",179}}]],</div><div> [[{byte,0}|-1],</div><div> [{gb_tree,0}|-1],</div>
<div> [{module,0}|-1],</div><div> [{node,0}|-1],</div><div> [{none,0}|-1],</div><div> [{queue,0}|-1],</div><div> [{reference,0}|-1],</div><div> [{max_rate,0},{line,{"recon_trace.erl",169}}]],</div>
<div> [[{atom,1}|-1],</div><div> [{maybe_improper_list,2}|-1],</div><div> [{nonempty_improper_list,2}|-1],</div><div> [{nonempty_maybe_improper_list,2}|-1]],</div><div> [[{bitstring,0}|-1],</div>
<div> [{nonempty_string,0}|-1],</div><div> [{range,2}|-1],</div><div> [{string,0}|-1]],</div><div> [[{digraph,0}|-1],[{max,0},{line,{"recon_trace.erl",182}}]],</div><div> [[{any,0}|-1],[{arity,0}|-1],[{array,0}|-1],[{binary,0}|-1]],</div>
<div> [],</div><div> [[{binary,2}|-1],[{integer,1}|-1],[{var,1}|-1]],</div><div> [[{bool,0}|-1],[{nil,0}|-1]],</div><div> [[{atom,0}|-1],[{list,1}|-1],[{nonempty_list,1}|-1],[{term,0}|-1]]}}})</div>
<div>(<0.25.0>) returned from dict:is_key/2 -> true</div><div><br></div><div>Indeed, in this case mfa/0 is part of the State and cannot be redefined, so the right branch of the case is executed.</div><div><br></div>
<div>R16B03:</div><div><br></div><div><div>$ erlc recon_trace.erl </div><div>(<0.25.0>) call dict:is_key({mfa,0},{dict,12,16,16,8,80,48,</div><div> {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},</div><div>
{{[[{shellfun,0}|{typeinfo,type,[{line,{"recon_trace.erl",165}}]}],</div>
<div> [{fn,0}|{typeinfo,type,[{line,{"recon_trace.erl",180}}]}]],</div><div> [],[],[],[],</div><div> [[{matchspec,0}|{typeinfo,type,[{line,{"recon_trace.erl",164}}]}],</div><div>
[{millisecs,0}|{typeinfo,type,[{line,{"recon_trace.erl",166}}]}],</div>
<div> [{pidspec,0}|{typeinfo,type,[{line,{"recon_trace.erl",167}}]}],</div><div> [{max_traces,0}|{typeinfo,type,[{line,{"recon_trace.erl",168}}]}],</div><div> [{options,0}|{typeinfo,type,[{line,{"recon_trace.erl",172}}]}],</div>
<div> [{args,0}|{typeinfo,type,[{line,{"recon_trace.erl",181}}]}],</div><div> [{num_matches,0}|{typeinfo,type,[{line,{"recon_trace.erl",183}}]}]],</div><div> [[{mod,0}|{typeinfo,type,[{line,{"recon_trace.erl",179}}]}]],</div>
<div> [[{max_rate,0}|{typeinfo,type,[{line,{"recon_trace.erl",169}}]}]],</div><div> [],[],</div><div> [[{max,0}|{typeinfo,type,[{line,{"recon_trace.erl",182}}]}]],</div><div> [],[],[],[],[]}}})</div>
<div>(<0.25.0>) returned from dict:is_key/2 -> false</div></div><div><br></div><div>It looks to me like the default types are not part of the state yet?</div><div><br></div><div>I need some coffee now.</div><div>
<br></div>-- <br>Roberto Aloi<br>---<br>Website: <a href="http://roberto-aloi.com" target="_blank">http://roberto-aloi.com</a><br>Twitter: @robertoaloi<br>
</div></div>