aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-01-13 12:48:06 +0100
committerBjörn Gustavsson <[email protected]>2016-01-13 12:48:06 +0100
commit9c5c0a2169b1ac176fa9d66eab47c48ff8325a39 (patch)
treedfe7a32c6653e36a79573ac21054204a64eb6d1f /lib/compiler
parentba8092e372b324bc5053ed5bd4ec1ad4b4b737bf (diff)
parent5a874a9e58e09a894f36ab81a0eef46e1fc27cd0 (diff)
downloadotp-9c5c0a2169b1ac176fa9d66eab47c48ff8325a39.tar.gz
otp-9c5c0a2169b1ac176fa9d66eab47c48ff8325a39.tar.bz2
otp-9c5c0a2169b1ac176fa9d66eab47c48ff8325a39.zip
Merge branch 'maint'
* maint: Fix crash when attempting to update a fun as if it were a map
Diffstat (limited to 'lib/compiler')
-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 7c229210a0..8074456be2 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -805,7 +805,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 b3cafe4ed9..af98584e00 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.