<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Thank you for reporting. =)<br>
<br>
The linter should realize it's not a map when dealing with
literals. It's just pass-through atm which is plainly obvious.<br>
<br>
Try this:
<a class="moz-txt-link-freetext" href="https://github.com/psyeugenic/otp/commits/egil/erts/fix-maps-beam_load">https://github.com/psyeugenic/otp/commits/egil/erts/fix-maps-beam_load</a><br>
<br>
<br>
.. heading back to compiler fixes ..<br>
<br>
// Björn-Egil<br>
<br>
On 2014-02-05 18:25, José Valim wrote:<br>
</div>
<blockquote
cite="mid:CAGnRm4LzHWgXRcknYQBCXbb1WZF7b9RW0xw_rTDhfvp7rha4RA@mail.gmail.com"
type="cite">
<div dir="ltr">Actually, it seems <font face="courier new,
monospace">M#{a := b}</font> always work when M is an empty
map:
<div><br>
</div>
<blockquote style="margin:0px 0px 0px
40px;border:none;padding:0px">
<div>
<div><font face="courier new, monospace">-module(foo).</font></div>
</div>
<div>
<div><font face="courier new, monospace">-compile(export_all).</font></div>
</div>
<div>
<div><font face="courier new, monospace"><br>
</font></div>
</div>
<div>
<div><font face="courier new, monospace">bat(M) -></font></div>
</div>
<div>
<div><font face="courier new, monospace"> M#{a := b}.</font></div>
</div>
</blockquote>
<div>
<div><br>
</div>
<div>Here is my session:</div>
</div>
<div><br>
</div>
<blockquote style="margin:0px 0px 0px
40px;border:none;padding:0px">
<div>
<div>
<div><font face="courier new, monospace">1> foo:bat(#{a
=> b}).</font></div>
</div>
</div>
<div>
<div><font face="courier new, monospace">#{a => b}</font></div>
</div>
<div>
<div><font face="courier new, monospace">2> foo:bat(#{b
=> b}).</font></div>
</div>
<div>
<div><font face="courier new, monospace">** exception error:
bad argument</font></div>
</div>
<div>
<div><font face="courier new, monospace"> in function
foo:bat/1 (foo.erl, line 5)</font></div>
</div>
<div>
<div>
<font face="courier new, monospace">3> foo:bat(#{}).</font></div>
</div>
<div>
<div><font face="courier new, monospace">#{a => b}</font></div>
</div>
</blockquote>
<font face="courier new, monospace"><br>
</font>
<div>3> was supposed to fail. Note <font face="courier new,
monospace">(#{})#{a := b} </font>works in the shell (eval).</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div><br>
</div>
<div><br>
</div>
<span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b><span
style="border-collapse:separate;font-family:arial;font-weight:normal">
<div>
<span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José
Valim</b></span></div>
<div><span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">
<div><span
style="font-family:verdana,sans-serif;font-size:x-small"><a
moz-do-not-send="true"
href="http://www.plataformatec.com.br/"
style="color:rgb(42,93,176)" target="_blank">www.plataformatec.com.br</a></span></div>
<div><span
style="font-family:verdana,sans-serif;font-size:x-small">Founder
and Lead Developer</span></div>
</span></div>
</span></b></span></div>
<br>
<br>
<div class="gmail_quote">On Wed, Feb 5, 2014 at 6:16 PM, José
Valim <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jose.valim@gmail.com" target="_blank">jose.valim@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello folks,
<div><br>
</div>
<div>Maps are not working properly on update with a
literal (via a var):</div>
<div><br>
</div>
<blockquote style="margin:0 0 0
40px;border:none;padding:0px">
<div>
<div><font face="courier new, monospace">-module(foo).</font></div>
</div>
<div>
<div><font face="courier new, monospace">-compile(export_all).</font></div>
</div>
<div>
<div><font face="courier new, monospace"><br>
</font></div>
</div>
<div>
<div><font face="courier new, monospace">%% This
function does not fail (and it should)</font></div>
</div>
<div>
<div><font face="courier new, monospace">bar() -></font></div>
</div>
<div>
<div><font face="courier new, monospace"> M = #{},</font></div>
</div>
<div>
<div><font face="courier new, monospace"> M#{a := b}.</font></div>
</div>
<div>
<div><font face="courier new, monospace"><br>
</font></div>
</div>
<div>
<div><font face="courier new, monospace">%% This
function fails horribly</font></div>
</div>
<div>
<div><font face="courier new, monospace">%%</font></div>
</div>
<div>
<div><font face="courier new, monospace">%% =ERROR
REPORT==== 5-Feb-2014::18:10:18 ===</font></div>
</div>
<div>
<div><font face="courier new, monospace">%%
beam/beam_load.c(2065): Error loading function
foo:baz/0: op update_map_exact p a r u u a a:</font></div>
</div>
<div>
<div><font face="courier new, monospace">%% no
specific operation found</font></div>
</div>
<div>
<div><font face="courier new, monospace">baz() -></font></div>
</div>
<div>
<div><font face="courier new, monospace"> M = nil,</font></div>
</div>
<div>
<div><font face="courier new, monospace"> M#{a := b}.</font></div>
</div>
</blockquote>
<div>
<div>
<div><br>
</div>
<div>I assume there is some sort of inlining happening
and discarding useful information.</div>
<div>
As far as I can see, the Erlang Abstract Format is
correct.</div>
<div><br>
</div>
<div>Thank you!</div>
<span class="HOEnZb"><font color="#888888">
<div><br>
</div>
<div><br>
</div>
<span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b><span
style="border-collapse:separate;font-family:arial;font-weight:normal">
<div>
<span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José
Valim</b></span></div>
<div><span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">
<div><span
style="font-family:verdana,sans-serif;font-size:x-small"><a
moz-do-not-send="true"
href="http://www.plataformatec.com.br/"
style="color:rgb(42,93,176)"
target="_blank">www.plataformatec.com.br</a></span></div>
<div><span
style="font-family:verdana,sans-serif;font-size:x-small">Founder
and Lead Developer</span></div>
</span></div>
</span></b></span></font></span></div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
</pre>
</blockquote>
<br>
</body>
</html>