aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-03-06 20:32:01 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-03-17 17:47:35 +0100
commitc43dd2abaae653d5411fc662cad177c5971dde3b (patch)
treea16ab4551d492b6ead784ecb4686bae855ea77e5
parent2890335ec4ecee6888d184a6dc73c7fc227c0566 (diff)
downloadotp-c43dd2abaae653d5411fc662cad177c5971dde3b.tar.gz
otp-c43dd2abaae653d5411fc662cad177c5971dde3b.tar.bz2
otp-c43dd2abaae653d5411fc662cad177c5971dde3b.zip
compiler: Support literal maps in cerl_clauses:match/2
-rw-r--r--lib/compiler/src/cerl_clauses.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/compiler/src/cerl_clauses.erl b/lib/compiler/src/cerl_clauses.erl
index 76d70dcabf..87bd47c08b 100644
--- a/lib/compiler/src/cerl_clauses.erl
+++ b/lib/compiler/src/cerl_clauses.erl
@@ -356,14 +356,19 @@ match(P, E, Bs) ->
end;
map ->
%% The most we can do is to say "definitely no match" if a
- %% binary pattern is matched against non-binary data.
+ %% map pattern is matched against non-map data.
case E of
any ->
{false, Bs};
_ ->
case type(E) of
- literal ->
- none;
+ literal ->
+ case is_map(concrete(E)) of
+ false ->
+ none;
+ true ->
+ {false, Bs}
+ end;
cons ->
none;
tuple ->