<div dir="ltr">Looks like the regression was introduced in 'hb/dialyzer/fix_recognition_of_records/OTP-11935' (805f9c89fc01220bc1bb0f27e1b68fd4eca688ba) included from OTP 17.1<div><br></div><div>This becomes a none-issue in the master branch (for 18) since variables are allowed as keys there but it needs to be solved for the 17 track.<br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-27 21:13 GMT+01:00 Björn-Egil Dahlberg <span dir="ltr"><<a href="mailto:wallentin.dahlberg@gmail.com" target="_blank">wallentin.dahlberg@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I managed to reproduce your errors on dt.erl and dt2.erl using OTP-17.3.3 tag.<div><br></div><div>Seems like I've missed something in dataflow .. looks like a clause missing for the map type.</div><div>I'm not well versed in dialyzer. Hopefully I can do a fix for it for 17.4.</div><div><br></div><div>There are a bit more stuff going on here too. When dialyzer uses the erlang compiler to compile to core</div><div>it does not coalesce things to literals but keeps them abstract instead .. </div><div>Compound keys such as [1,2,3] and {4,5,6} will thus become non-literals (variables) and such keys are not allowed in maps. </div><div><br></div><div>I need to ponder that a bit before I try to solve it.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>// Björn-Egil</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2014-11-27 13:20 GMT+01:00 Ivan Uemlianin <span dir="ltr"><<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Dave<br>
<br>
Thanks for your help. Here are some more details:<br>
<br>
<br>
*** OS: FreeBSD 10.0-RELEASE<br>
<br>
$ uname -a<br>
FreeBSD simba 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root@snap.freebsd.org:/usr/<u></u>obj/usr/src/sys/GENERIC amd64<br>
<br>
Upgrading to 10.1 is on my todo list.<br>
<br>
<br>
*** Erlang version now 17.3_3,3<br>
<br>
$ pkg info erlang<br>
erlang-17.3_1,3<br>
...<br>
$ sudo pkg upgrade<br>
...<br>
<br>
$ pkg info erlang<br>
erlang-17.3_3,3<br>
...<br>
<br>
<br>
*** Errors persist<br>
<br>
Upgrading erlang has not changed behaviour.<br>
<br>
A couple more observations:<br>
<br>
1. Running dialyzer on the module dt below gets the error as noted previously. However, if I uncomment the '%% ok' line, dialyzer will process the module with no problems.<br>
<br>
-module(dt).<span><br>
-export([get_map/0]).<br>
<br>
-spec get_map() -> map().<br>
get_map() -><br>
#{labels => [one, two],<br>
number => 27,<br></span>
%% [1,2,3] => wer, %% ok<span><br>
kvok => #{<br>
a => qwe,<br>
2 => asd,<br>
[1,2,3] => wer, %% bad<br>
{4,5,6} => sdf, %% bad<br>
"abc" => zxc<br>
}<br>
}.<br>
<br></span>
$ dialyzer dt.erl<br>
Checking whether the PLT /home/ivan/.dialyzer_plt is up-to-date... yes<br>
Proceeding with analysis...<br>
=ERROR REPORT==== 27-Nov-2014::12:17:02 ===<span><br>
Error in process <0.45.0> with exit value: {{case_clause,map},[{dialyzer_<u></u>dataflow,find_terminals,1,[{<u></u>file,"dialyzer_dataflow.erl"},<u></u>{line,3451}]},{dialyzer_<u></u>dataflow,find_terminals_list,<u></u>3,[{file,"dialyzer_dataflow.<u></u>erl"},{line,3504}]},{dialyzer_<u></u>dataflow,classify_returns... <br>
<br>
<br></span><span>
dialyzer: Analysis failed with error:<br></span><span>
{{case_clause,map},<br>
[{dialyzer_dataflow,find_<u></u>terminals,1,<br>
[{file,"dialyzer_dataflow.erl"<u></u>},{line,3451}]},<br>
{dialyzer_dataflow,find_<u></u>terminals_list,3,<br>
[{file,"dialyzer_dataflow.erl"<u></u>},{line,3504}]},<br>
{dialyzer_dataflow,classify_<u></u>returns,1,<br>
[{file,"dialyzer_dataflow.erl"<u></u>},{line,3443}]},<br>
{dialyzer_dataflow,'-state__<u></u>get_warnings/2-fun-0-',7,<br>
[{file,"dialyzer_dataflow.erl"<u></u>},{line,2908}]},<br>
{lists,foldl,3,[{file,"lists.<u></u>erl"},{line,1261}]},<br>
{dialyzer_dataflow,state__get_<u></u>warnings,2,<br>
[{file,"dialyzer_dataflow.erl"<u></u>},{line,2934}]},<br>
{dialyzer_dataflow,get_<u></u>warnings,5,<br>
[{file,"dialyzer_dataflow.erl"<u></u>},{line,142}]},<br>
{dialyzer_succ_typings,<u></u>collect_warnings,2,<br>
[{file,"dialyzer_succ_typings.<u></u>erl"},{line,182}]}]}<br></span><span>
Last messages in the log cache:<br>
Reading files and computing callgraph... done in 0.07 secs<br>
Removing edges... done in 0.00 secs<br>
<br>
<br></span>
2. Running dialyzer on the module dt2 below raises the warning following. Uncommenting the '%% ok' line has no effect.<br>
<br>
-module(dt2).<span><br>
-export([get_map/0]).<br>
<br>
-spec get_map() -> map().<br>
get_map() -><br></span>
X = #{labels => [one, two],<br>
number => 27,<br>
%% [1,2,3] => wer, %% ok<span><br>
kvok => #{<br>
a => qwe,<br>
2 => asd,<br>
[1,2,3] => wer, %% bad<br>
{4,5,6} => sdf, %% bad<br>
"abc" => zxc<br>
}<br></span>
},<br>
X.<br>
<br>
$ dialyzer dt2.erl<br>
Checking whether the PLT /home/ivan/.dialyzer_plt is up-to-date... yes<br>
Proceeding with analysis...<br>
dt2.erl:5: Function get_map/0 has no local return<br>
done in 0m0.41s<br>
done (warnings were emitted)<br>
<br>
Best wishes<span><font color="#888888"><br>
<br>
Ivan</font></span><div><div><br>
<br>
<br>
<br>
On 11/25/14 20:37, Dave Cottlehuber wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry about that last email …<br>
<br>
EWORKSFORME.<br>
<br>
FreeBSD 10.1 amd64, erlang-17.3_2,3 from pkg.<br>
<br>
What FreeBSD & erlang are you using?<br>
<br>
dch /tmp ❯❯❯ dialyzer --build_plt --apps erts kernel stdlib<br>
Creating PLT /home/dch/.dialyzer_plt ...<br>
Unknown functions:<br>
compile:file/2<br>
compile:forms/2<br>
compile:noenv_forms/2<br>
compile:output_generated/1<br>
crypto:block_decrypt/4<br>
crypto:start/0<br>
Unknown types:<br>
compile:option/0<br>
done in 1m8.53s<br>
done (passed successfully)<br>
<br>
dch /tmp ❯❯❯dialyzer ltu.erl<br>
Checking whether the PLT /home/dch/.dialyzer_plt is up-to-date... yes<br>
Proceeding with analysis... done in 0m0.41s<br>
done (passed successfully)<br>
<br>
dch /tmp ❯❯❯erl<br>
Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:8:8] [async-threads:64] [kernel-poll:true]<br>
<br>
Eshell V6.2 (abort with ^G)<br>
1><br>
<br>
A+, Dave<br>
— sent from my Couch<br>
<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</blockquote>
<br></div></div>
-- <br>
==============================<u></u>==============================<span><br>
Ivan A. Uemlianin PhD<br>
Llaisdy<br>
Speech Technology Research and Development<br>
<br></span><span>
<a href="mailto:ivan@llaisdy.com" target="_blank">ivan@llaisdy.com</a><br>
@llaisdy<br>
<a href="http://llaisdy.wordpress.com" target="_blank">llaisdy.wordpress.com</a><br>
<a href="http://github.com/llaisdy" target="_blank">github.com/llaisdy</a><br>
<a href="http://www.linkedin.com/in/ivanuemlianin" target="_blank">www.linkedin.com/in/<u></u>ivanuemlianin</a><br>
<br>
festina lente<br>
==============================<u></u>==============================<br>
<br></span><div><div>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>