aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-02-13 17:39:52 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-02-19 15:32:18 +0100
commitfddad198019039ade815aedb38f44d54945e56a5 (patch)
tree6b51c6cf4337e75b1afe964ea1bd55c37f11a6d8 /lib/compiler
parentbd1ced90995f6084f2ac7b2b0d5cc2cc92cfe5a9 (diff)
downloadotp-fddad198019039ade815aedb38f44d54945e56a5.tar.gz
otp-fddad198019039ade815aedb38f44d54945e56a5.tar.bz2
otp-fddad198019039ade815aedb38f44d54945e56a5.zip
compiler: Test Maps aliasing
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/test/map_SUITE.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index 86f65c3ed6..b76108005c 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -30,6 +30,7 @@
t_list_comprehension/1,
t_map_sort_literals/1,
t_map_size/1,
+ t_build_and_match_aliasing/1,
%% warnings
t_warn_useless_build/1,
@@ -54,6 +55,8 @@ all() -> [
t_guard_bifs, t_guard_sequence, t_guard_update,
t_guard_receive,t_guard_fun, t_list_comprehension,
t_map_sort_literals,
+ t_map_size,
+ t_build_and_match_aliasing,
%% warnings
t_warn_useless_build,
@@ -112,6 +115,20 @@ t_build_and_match_literals(Config) when is_list(Config) ->
{'EXIT',{{badmatch,_},_}} = (catch (#{x:=3} = id(#{x=>"three"}))),
ok.
+t_build_and_match_aliasing(Config) when is_list(Config) ->
+ M1 = id(#{a=>1,b=>2,c=>3,d=>4}),
+ #{c:=C1=_=_=C2} = M1,
+ true = C1 =:= C2,
+ #{a:=A,a:=A,a:=A,b:=B,b:=B} = M1,
+ #{a:=A,a:=A,a:=A,b:=B,b:=B,b:=2} = M1,
+ #{a:=A=1,a:=A,a:=A,b:=B=2,b:=B,b:=2} = M1,
+ #{c:=C1, c:=_, c:=3, c:=_, c:=C2} = M1,
+ #{c:=C=_=3=_=C} = M1,
+
+ M2 = id(#{"a"=>1,"b"=>2,"c"=>3,"d"=>4}),
+ #{"a":=A2,"a":=A2,"a":=A2,"b":=B2,"b":=B2,"b":=2} = M2,
+ #{"a":=_,"a":=_,"a":=_,"b":=_,"b":=_,"b":=2} = M2,
+ ok.
t_map_size(Config) when is_list(Config) ->
0 = map_size(id(#{})),