aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-03-14 16:22:21 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-03-17 17:47:36 +0100
commita65e0c133314e57adc39a53b48f2cd6ba73b2fe8 (patch)
tree6ebdaaa0649e7cb819daec3de9e3a25f14252174 /lib/stdlib
parent4043888ac064a1596da89d8c482d799f2b5a997f (diff)
downloadotp-a65e0c133314e57adc39a53b48f2cd6ba73b2fe8.tar.gz
otp-a65e0c133314e57adc39a53b48f2cd6ba73b2fe8.tar.bz2
otp-a65e0c133314e57adc39a53b48f2cd6ba73b2fe8.zip
stdlib: Accept records as Map keys
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/erl_lint.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index db98c7020c..4c0261a1ad 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -2337,7 +2337,7 @@ is_valid_map_key_value(K) ->
Tag =:= map_field_exact ->
B andalso is_valid_map_key_value(Ke)
andalso is_valid_map_key_value(Ve)
- end, true, Ps);
+ end,true,Ps);
{map,_,Ps} ->
foldl(fun
({Tag,_,Ke,Ve},B) when Tag =:= map_field_assoc;
@@ -2345,13 +2345,19 @@ is_valid_map_key_value(K) ->
B andalso is_valid_map_key_value(Ke)
andalso is_valid_map_key_value(Ve)
end, true, Ps);
+ {record,_,_,Fs} ->
+ foldl(fun
+ ({record_field,_,Ke,Ve},B) ->
+ B andalso is_valid_map_key_value(Ke)
+ andalso is_valid_map_key_value(Ve)
+ end,true,Fs);
{bin,_,Es} ->
% only check for value expressions to be valid
% invalid binary expressions are later checked in
% core and kernel
foldl(fun
({bin_element,_,E,_,_},B) ->
- B andalso is_valid_map_key_value(E)
+ B andalso is_valid_map_key_value(E)
end,true,Es);
_ -> false
end.