[erlang-bugs] Maps behaving oddly on update syntax with literal

José Valim <>
Wed Feb 5 18:16:40 CET 2014


Hello folks,

Maps are not working properly on update with a literal (via a var):

-module(foo).
-compile(export_all).

%% This function does not fail (and it should)
bar() ->
  M = #{},
  M#{a := b}.

%% This function fails horribly
%%
%% =ERROR REPORT==== 5-Feb-2014::18:10:18 ===
%% beam/beam_load.c(2065): Error loading function foo:baz/0: op
update_map_exact p a r u u a a:
%% no specific operation found
baz() ->
  M = nil,
  M#{a := b}.


I assume there is some sort of inlining happening and discarding useful
information.
As far as I can see, the Erlang Abstract Format is correct.

Thank you!


* José Valimwww.plataformatec.com.br <http://www.plataformatec.com.br/>
Founder and Lead Developer*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140205/f15bbd20/attachment.html>


More information about the erlang-bugs mailing list