aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-02-03 10:00:13 +0100
committerBjörn Gustavsson <[email protected]>2015-02-12 13:14:38 +0100
commit116e8aa05f84ee66aead2792b07b644c7f3e8fcd (patch)
tree10045e9a42f0d3594cb65c775bc47f6641c02c3f /lib/compiler
parentd5a5df2d00f62ee580156bee605b0c4519f625f1 (diff)
downloadotp-116e8aa05f84ee66aead2792b07b644c7f3e8fcd.tar.gz
otp-116e8aa05f84ee66aead2792b07b644c7f3e8fcd.tar.bz2
otp-116e8aa05f84ee66aead2792b07b644c7f3e8fcd.zip
cerl: Teach is_literal_term/1 to handle maps
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/cerl.erl2
-rw-r--r--lib/compiler/test/core_fold_SUITE.erl5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/compiler/src/cerl.erl b/lib/compiler/src/cerl.erl
index 5d6997da11..3d4b9ee0c6 100644
--- a/lib/compiler/src/cerl.erl
+++ b/lib/compiler/src/cerl.erl
@@ -434,6 +434,8 @@ is_literal_term([H | T]) ->
is_literal_term(T) when is_tuple(T) ->
is_literal_term_list(tuple_to_list(T));
is_literal_term(B) when is_bitstring(B) -> true;
+is_literal_term(M) when is_map(M) ->
+ is_literal_term_list(maps:to_list(M));
is_literal_term(_) ->
false.
diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl
index a52610497f..512aada203 100644
--- a/lib/compiler/test/core_fold_SUITE.erl
+++ b/lib/compiler/test/core_fold_SUITE.erl
@@ -197,7 +197,10 @@ foo(A, B, C) ->
A + B + C.
bifs(Config) when is_list(Config) ->
- ?line <<1,2,3,4>> = id(list_to_binary([1,2,3,4])),
+ <<1,2,3,4>> = id(list_to_binary([1,2,3,4])),
+ K = {a,key},
+ V = {a,value},
+ {ok,#{K:=V}} = id(list_to_tuple([ok,#{K=>V}])),
ok.
-define(CMP_SAME(A0, B), (fun(A) -> true = A == B, false = A /= B end)(id(A0))).