diff options
author | Anthony Ramine <[email protected]> | 2014-03-09 20:46:08 +0100 |
---|---|---|
committer | Anthony Ramine <[email protected]> | 2014-03-15 21:27:23 +0100 |
commit | 4185be0ad649bccb15bb67a15b618b6cc14fe253 (patch) | |
tree | 6b49268d3fb88b0eb4ea9dfc72354319b4715181 /lib/stdlib/src/erl_eval.erl | |
parent | 5bc10a4ed286247274efa338b7d82b2d1f5534d6 (diff) | |
download | otp-4185be0ad649bccb15bb67a15b618b6cc14fe253.tar.gz otp-4185be0ad649bccb15bb67a15b618b6cc14fe253.tar.bz2 otp-4185be0ad649bccb15bb67a15b618b6cc14fe253.zip |
Fix evaluation of empty map patterns in erl_lint
Reported-by: José Valim
Diffstat (limited to 'lib/stdlib/src/erl_eval.erl')
-rw-r--r-- | lib/stdlib/src/erl_eval.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/stdlib/src/erl_eval.erl b/lib/stdlib/src/erl_eval.erl index 3974fbc4ec..acde3ad5d6 100644 --- a/lib/stdlib/src/erl_eval.erl +++ b/lib/stdlib/src/erl_eval.erl @@ -1123,9 +1123,10 @@ match1({tuple,_,Elts}, Tuple, Bs, BBs) match_tuple(Elts, Tuple, 1, Bs, BBs); match1({tuple,_,_}, _, _Bs, _BBs) -> throw(nomatch); -match1({map,_,Fs}, Map, Bs, BBs) -> +match1({map,_,Fs}, #{}=Map, Bs, BBs) -> match_map(Fs, Map, Bs, BBs); - +match1({map,_,_}, _, _Bs, _BBs) -> + throw(nomatch); match1({bin, _, Fs}, <<_/bitstring>>=B, Bs0, BBs) -> eval_bits:match_bits(Fs, B, Bs0, BBs, match_fun(BBs), |