aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-03-13 02:10:28 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-03-17 17:47:36 +0100
commit4043888ac064a1596da89d8c482d799f2b5a997f (patch)
treefaaef33484ee23383879fbdc38430958c48c9d77 /lib/stdlib/src
parent66039320f16622b62fe9dbd413034171130d4de4 (diff)
downloadotp-4043888ac064a1596da89d8c482d799f2b5a997f.tar.gz
otp-4043888ac064a1596da89d8c482d799f2b5a997f.tar.bz2
otp-4043888ac064a1596da89d8c482d799f2b5a997f.zip
stdlib: Accept Maps as Map keys
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/erl_lint.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index 3b3e4db518..db98c7020c 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -2328,6 +2328,23 @@ is_valid_map_key_value(K) ->
foldl(fun(E,B) ->
B andalso is_valid_map_key_value(E)
end,true,Es);
+ {map,_,Arg,Ps} ->
+ % only check for value expressions to be valid
+ % invalid map expressions are later checked in
+ % core and kernel
+ is_valid_map_key_value(Arg) andalso foldl(fun
+ ({Tag,_,Ke,Ve},B) when Tag =:= map_field_assoc;
+ Tag =:= map_field_exact ->
+ B andalso is_valid_map_key_value(Ke)
+ andalso is_valid_map_key_value(Ve)
+ end, true, Ps);
+ {map,_,Ps} ->
+ foldl(fun
+ ({Tag,_,Ke,Ve},B) when Tag =:= map_field_assoc;
+ Tag =:= map_field_exact ->
+ B andalso is_valid_map_key_value(Ke)
+ andalso is_valid_map_key_value(Ve)
+ end, true, Ps);
{bin,_,Es} ->
% only check for value expressions to be valid
% invalid binary expressions are later checked in