aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/receive_SUITE.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-02-28 09:21:39 +0100
committerJohn Högberg <[email protected]>2019-02-28 09:21:39 +0100
commit236436e82f97652c8375d51f8eded9bd4a3201f4 (patch)
tree7c0a92e1f6712013dbba8e7dc0dc3bcd73e09250 /lib/compiler/test/receive_SUITE.erl
parentb0f099c8a7eb47ee2b894f58b8e71bb28c512be8 (diff)
parent69d2b9c3c8d6cde36b1f8b64f17f183b840a04b6 (diff)
downloadotp-236436e82f97652c8375d51f8eded9bd4a3201f4.tar.gz
otp-236436e82f97652c8375d51f8eded9bd4a3201f4.tar.bz2
otp-236436e82f97652c8375d51f8eded9bd4a3201f4.zip
Merge branch 'john/compiler/refactor-validator-type-management'
* john/compiler/refactor-validator-type-management: beam_validator: Clarify a comment beam_validator: Make call argument validation stricter beam_validator: Don't explode when building terms in receive beam_validator: Improve 'binary' type tracking beam_validator: Infer tuple element types beam_validator: Tolerate the 'receive' hack in prim_eval beam_validator: Track types by value rather than by register beam_validator: Disregard 'none' on join beam_validator: Handle is_number, and join(float,int) -> number beam_validator: Treat is_nil as is_eq_exact with nil beam_validator: Simplify get_element_type beam_validator: Fix literal handling in meet/2 beam_validator: Use literals as keys in container (tuple) elements beam_validator: Refactor try/catch handling, again beam_validator: Refactor register initialization beam_validator: Refactor stack allocation beam_validator: Handle argument/return types for more functions beam_validator: Don't forget last element when using put_tuple beam_jump: Fail label of select_val is unsafe for move elimination cerl_sets: Use maps:filter/2 in filter/2
Diffstat (limited to 'lib/compiler/test/receive_SUITE.erl')
-rw-r--r--lib/compiler/test/receive_SUITE.erl30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/compiler/test/receive_SUITE.erl b/lib/compiler/test/receive_SUITE.erl
index 12108445f0..0038eb1a4b 100644
--- a/lib/compiler/test/receive_SUITE.erl
+++ b/lib/compiler/test/receive_SUITE.erl
@@ -25,7 +25,8 @@
init_per_group/2,end_per_group/2,
init_per_testcase/2,end_per_testcase/2,
export/1,recv/1,coverage/1,otp_7980/1,ref_opt/1,
- wait/1,recv_in_try/1,double_recv/1,receive_var_zero/1]).
+ wait/1,recv_in_try/1,double_recv/1,receive_var_zero/1,
+ match_built_terms/1]).
-include_lib("common_test/include/ct.hrl").
@@ -45,7 +46,8 @@ all() ->
groups() ->
[{p,test_lib:parallel(),
[recv,coverage,otp_7980,ref_opt,export,wait,
- recv_in_try,double_recv,receive_var_zero]}].
+ recv_in_try,double_recv,receive_var_zero,
+ match_built_terms]}].
init_per_suite(Config) ->
@@ -400,5 +402,29 @@ receive_var_zero(Config) when is_list(Config) ->
zero() -> 0.
+%% ERL-862; the validator would explode when a term was constructed in a
+%% receive guard.
+
+-define(MATCH_BUILT_TERM(Ref, Expr),
+ (fun() ->
+ Ref = make_ref(),
+ A = id($a),
+ B = id($b),
+ Built = id(Expr),
+ self() ! {Ref, A, B},
+ receive
+ {Ref, A, B} when Expr =:= Built ->
+ ok
+ after 5000 ->
+ ct:fail("Failed to match message with term built in "
+ "receive guard.")
+ end
+ end)()).
+
+match_built_terms(Config) when is_list(Config) ->
+ ?MATCH_BUILT_TERM(Ref, [A, B]),
+ ?MATCH_BUILT_TERM(Ref, {A, B}),
+ ?MATCH_BUILT_TERM(Ref, <<A, B>>),
+ ?MATCH_BUILT_TERM(Ref, #{ 1 => A, 2 => B}).
id(I) -> I.