diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-11 14:50:46 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-17 17:47:35 +0100 |
commit | 90a948d7cf7f188b5461c2a7bb25a656ec681966 (patch) | |
tree | 9e114d1103136b6e85b6316726347a876ae127b7 /lib/compiler/src/cerl.erl | |
parent | c43dd2abaae653d5411fc662cad177c5971dde3b (diff) | |
download | otp-90a948d7cf7f188b5461c2a7bb25a656ec681966.tar.gz otp-90a948d7cf7f188b5461c2a7bb25a656ec681966.tar.bz2 otp-90a948d7cf7f188b5461c2a7bb25a656ec681966.zip |
compiler: Validate Map src
Reject all expressions that are known to fail.
Emit 'badarg' for those expressions.
Ex.
[]#{ a => 1}
Is not a valid map update expression.
Diffstat (limited to 'lib/compiler/src/cerl.erl')
-rw-r--r-- | lib/compiler/src/cerl.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compiler/src/cerl.erl b/lib/compiler/src/cerl.erl index 744ebc7aca..9024999d7f 100644 --- a/lib/compiler/src/cerl.erl +++ b/lib/compiler/src/cerl.erl @@ -1585,9 +1585,9 @@ map_val(#c_map{var = M}) -> M. ann_c_map(As,Es) -> - ann_c_map(As, #c_literal{val=[]}, Es). + ann_c_map(As, #c_literal{val=#{}}, Es). -ann_c_map(As,#c_literal{val=[]}=M,Es) -> +ann_c_map(As,#c_literal{val=Mval}=M,Es) when is_map(Mval), map_size(Mval) =:= 0 -> Pairs = [[K,V]||#c_map_pair{key=K,val=V}<-Es], IsLit = lists:foldl(fun(Pair,Res) -> Res andalso is_lit_list(Pair) |