aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/map_SUITE.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-04-04 12:00:07 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-04-04 12:00:07 +0200
commit89eef897c6564c72d9717228a73959339e486bdb (patch)
treeebb39bfd3e9bbd3526b2996e36f1d57ee1f0b2c8 /lib/compiler/test/map_SUITE.erl
parent76c73b9554a3d74b027bc2e1fdace7192b7a8de6 (diff)
parente26dbc750fdd207c852bf9006668c5771f465dcf (diff)
downloadotp-89eef897c6564c72d9717228a73959339e486bdb.tar.gz
otp-89eef897c6564c72d9717228a73959339e486bdb.tar.bz2
otp-89eef897c6564c72d9717228a73959339e486bdb.zip
Merge branch 'egil/maps-fix-map-key-patterns'
* egil/maps-fix-map-key-patterns: stdlib: Fix erl_id_trans example stdlib: Deny map keys defined as #{ .. := .. } in patterns compiler: Fix compiling map keys in patterns from core compiler,stdlib: Fix Map literals as keys for Maps in patterns
Diffstat (limited to 'lib/compiler/test/map_SUITE.erl')
-rw-r--r--lib/compiler/test/map_SUITE.erl5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index cc018e4305..403b7e8405 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -113,6 +113,10 @@ t_build_and_match_literals(Config) when is_list(Config) ->
M = #{ map_1:=#{ map_2:=#{value_3 := third}, value_2:= second}, value_1:=first} =
id(#{ map_1=>#{ map_2=>#{value_3 => third}, value_2=> second}, value_1=>first}),
+ %% map key
+ #{ #{} := 42 } = id(#{ #{} => 42 }),
+ #{ #{ "a" => 3 } := 42 } = id(#{ #{ "a" => 3} => 42 }),
+
%% nil key
#{[]:=ok,1:=2} = id(#{[]=>ok,1=>2}),
@@ -123,6 +127,7 @@ t_build_and_match_literals(Config) when is_list(Config) ->
{'EXIT',{{badmatch,_},_}} = (catch (#{x:=3} = id(#{y=>3}))),
{'EXIT',{{badmatch,_},_}} = (catch (#{x:=3} = id(#{x=>"three"}))),
{'EXIT',{badarg,_}} = (catch id(#{<<0:258>> =>"three"})),
+ {'EXIT',{{badmatch,_},_}} = (catch (#{#{"a"=>42} := 3}=id(#{#{"a"=>3}=>42}))),
ok.
t_build_and_match_aliasing(Config) when is_list(Config) ->