aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-01-16 09:17:03 +0100
committerBjörn Gustavsson <[email protected]>2015-01-16 09:17:03 +0100
commit4c68e41041bb178905bff490f3f77f53fef7cc17 (patch)
tree455822b658daca71ed5101958c1610ca77f41271 /lib/compiler/test
parent393f065ccdb9fc318b89893c303b428210c974ab (diff)
parent85701edb6bdfe7c616a8486542dc2ca4bd787113 (diff)
downloadotp-4c68e41041bb178905bff490f3f77f53fef7cc17.tar.gz
otp-4c68e41041bb178905bff490f3f77f53fef7cc17.tar.bz2
otp-4c68e41041bb178905bff490f3f77f53fef7cc17.zip
Merge branch 'bjorn/compiler/map-in-record-bug/OTP-12402' into maint
* bjorn/compiler/map-in-record-bug/OTP-12402: sys_core_fold: Correct optimization of 'case'
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/match_SUITE.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl
index ae7d764535..e5aaf49d6f 100644
--- a/lib/compiler/test/match_SUITE.erl
+++ b/lib/compiler/test/match_SUITE.erl
@@ -22,7 +22,7 @@
init_per_group/2,end_per_group/2,
pmatch/1,mixed/1,aliases/1,match_in_call/1,
untuplify/1,shortcut_boolean/1,letify_guard/1,
- selectify/1,underscore/1,coverage/1]).
+ selectify/1,underscore/1,match_map/1,coverage/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -35,7 +35,8 @@ all() ->
groups() ->
[{p,test_lib:parallel(),
[pmatch,mixed,aliases,match_in_call,untuplify,
- shortcut_boolean,letify_guard,selectify,underscore,coverage]}].
+ shortcut_boolean,letify_guard,selectify,
+ underscore,match_map,coverage]}].
init_per_suite(Config) ->
@@ -400,6 +401,17 @@ underscore(Config) when is_list(Config) ->
_ = is_list(Config),
ok.
+-record(s, {map,t}).
+
+match_map(Config) when is_list(Config) ->
+ Map = #{key=>{x,y},ignore=>anything},
+ #s{map=Map,t={x,y}} = do_match_map(#s{map=Map}),
+ ok.
+
+do_match_map(#s{map=#{key:=Val}}=S) ->
+ %% Would crash with a 'badarg' exception.
+ S#s{t=Val}.
+
coverage(Config) when is_list(Config) ->
%% Cover beam_dead.
ok = coverage_1(x, a),