summaryrefslogtreecommitdiff
path: root/lib/compiler/test/map_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2020-02-13 12:37:33 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2020-02-17 10:33:53 +0100
commit0e30237d28d5267b758e7f115117ae14f0a5fcf5 (patch)
treef84b4b9fd77aa575877f541781bbc8fda3c64137 /lib/compiler/test/map_SUITE.erl
parentb5ff50d6103e2452730adc95cd82b9876d15a922 (diff)
downloaderlang-0e30237d28d5267b758e7f115117ae14f0a5fcf5.tar.gz
beam_kernel_to_ssa: Try to harder to avoid try/catch
When evaluating a guard expression in a try/catch, try harder to eliminate the try/catch. This is important for expression in binaries and maps in a receive. In a receive, it is not allowed to use a try/catch, because it will force a stack frame and saving of registers to the stack frame.
Diffstat (limited to 'lib/compiler/test/map_SUITE.erl')
-rw-r--r--lib/compiler/test/map_SUITE.erl32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index d8fdc8a080..46c1acef4c 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -2251,6 +2251,38 @@ t_key_expressions(_Config) ->
no_match = F4(42, 0, #{2 => value}),
no_match = F4(42, a, #{2 => value}),
+ F5 = fun(Term) ->
+ self() ! Term,
+ receive
+ #{[<<(3 bsr 30 + 2):0,$k:[]/signed-integer>>] := _} ->
+ ok;
+ 0.5 ->
+ error
+ end
+ end,
+ error = F5(0.5),
+
+ F6 = fun(Term) ->
+ self() ! Term,
+ receive
+ #{<<a/utf8>> := {a,b,c}} -> ok;
+ Other -> {error,Other}
+ end
+ end,
+ {error,any} = F6(any),
+
+ F7 = fun(Term) ->
+ self() ! Term,
+ (?MODULE:all()):a(catch
+ receive
+ <<1.14:{<<"a":(tuple_size(1))>>}>> ->
+ 4;
+ Other ->
+ Other
+ end)
+ end,
+ {'EXIT',{badarg,_}} = (catch F7(whatever)),
+
ok.
t_duplicate_keys(Config) when is_list(Config) ->