aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-13 12:31:36 +0100
committerBjörn Gustavsson <[email protected]>2016-01-13 12:31:36 +0100
commit5a874a9e58e09a894f36ab81a0eef46e1fc27cd0 (patch)
tree7f1b120b479fc1b6c9ecef81ba62bbe7cd670f08 /lib
parent72d6687a6514c6cd2e0af5b67760b5f83f62915c (diff)
parentff2ef4278045c985738e3ddb4af6127c7db933e7 (diff)
downloadotp-5a874a9e58e09a894f36ab81a0eef46e1fc27cd0.tar.gz
otp-5a874a9e58e09a894f36ab81a0eef46e1fc27cd0.tar.bz2
otp-5a874a9e58e09a894f36ab81a0eef46e1fc27cd0.zip
Merge branch 'bjorn/compiler/map-bug/OTP-13231' into maint
* bjorn/compiler/map-bug/OTP-13231: Fix crash when attempting to update a fun as if it were a map
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/v3_core.erl2
-rw-r--r--lib/compiler/test/map_SUITE.erl3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index 0941ad5dd5..7d93e2ae16 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -804,7 +804,7 @@ map_op(map_field_assoc) -> #c_literal{val=assoc};
map_op(map_field_exact) -> #c_literal{val=exact}.
is_valid_map_src(#c_literal{val = M}) when is_map(M) -> true;
-is_valid_map_src(#c_var{}) -> true;
+is_valid_map_src(#c_var{}=Var) -> not cerl:is_c_fname(Var);
is_valid_map_src(_) -> false.
%% try_exception([ExcpClause], St) -> {[ExcpVar],Handler,St}.
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index 411b15eebe..cff3b5deb4 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -883,6 +883,9 @@ t_update_map_expressions(Config) when is_list(Config) ->
%% Error cases.
{'EXIT',{{badmap,<<>>},_}} = (catch (id(<<>>))#{ a := 42, b => 2 }),
{'EXIT',{{badmap,[]},_}} = (catch (id([]))#{ a := 42, b => 2 }),
+ {'EXIT',{{badmap,_},_}} =
+ (catch (fun t_update_map_expressions/1)#{u => 42}),
+
ok.