aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-08-22 10:17:00 +0200
committerBjörn Gustavsson <[email protected]>2018-08-22 10:35:47 +0200
commit840b04bbd9359375a7491f5555bf84363cd08d22 (patch)
tree520905d7ee366f7d31234df0b5e755f5e2813ef6 /lib/compiler
parente8deb9f8ff3cb32286ca9b87a36b23aadffd1a49 (diff)
downloadotp-840b04bbd9359375a7491f5555bf84363cd08d22.tar.gz
otp-840b04bbd9359375a7491f5555bf84363cd08d22.tar.bz2
otp-840b04bbd9359375a7491f5555bf84363cd08d22.zip
map_SUITE: Test is_map_key/2 followed by a map update
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/test/map_SUITE.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index f1b09869f2..3e0ab78390 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -1283,6 +1283,13 @@ t_guard_bifs(Config) when is_list(Config) ->
error = beam_dead_5(#{k=>false}),
error = beam_dead_3(#{}),
+ %% Test is_map_key/2 followed by map update.
+
+ Used0 = map_usage(var, #{other=>value}),
+ Used0 = #{other=>value,var=>dead},
+ Used1 = map_usage(var, #{var=>live}),
+ Used1 = #{var=>live},
+
ok.
map_guard_empty() when is_map(#{}); false -> true.
@@ -1357,6 +1364,14 @@ beam_dead_5(#{}=M) when map_get(k, M) ->
beam_dead_5(#{}) ->
error.
+%% Test is_map_key/2, followed by an update of the map.
+map_usage(Def, Used) ->
+ case is_map_key(Def, Used) of
+ true -> Used;
+ false -> Used#{Def=>dead}
+ end.
+
+
t_guard_sequence(Config) when is_list(Config) ->
{1, "a"} = map_guard_sequence_1(#{seq=>1,val=>id("a")}),
{2, "b"} = map_guard_sequence_1(#{seq=>2,val=>id("b")}),