aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-02-08 14:37:56 +0100
committerJohn Högberg <[email protected]>2019-02-08 15:48:17 +0100
commit0610566c58fdebb8f2fa2ffe5196278fc6052d10 (patch)
tree171f96102a73c6667d5ff2c671122596228c9eb2 /lib
parentbd6837de0be42ce8be68bef1e8d027654c81a2b6 (diff)
downloadotp-0610566c58fdebb8f2fa2ffe5196278fc6052d10.tar.gz
otp-0610566c58fdebb8f2fa2ffe5196278fc6052d10.tar.bz2
otp-0610566c58fdebb8f2fa2ffe5196278fc6052d10.zip
beam_validator: type_test in BIFs that only fail on invalid types
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler/src/beam_validator.erl6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 6816c8a372..984d668532 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -604,8 +604,7 @@ valfun_4({make_fun2,_,_,_,Live}, Vst) ->
call(make_fun, Live, Vst);
%% Other BIFs
valfun_4({bif,tuple_size,{f,Fail},[Tuple],Dst}=I, Vst0) ->
- Vst1 = branch_state(Fail, Vst0),
- Vst = update_type(fun meet/2, {tuple,[0],#{}}, Tuple, Vst1),
+ Vst = type_test(Fail, {tuple,[0],#{}}, Tuple, Vst0),
set_type_reg_expr({integer,[]}, I, Dst, Vst);
valfun_4({bif,element,{f,Fail},[Pos,Tuple],Dst}, Vst0) ->
PosType = get_durable_term_type(Pos, Vst0),
@@ -635,8 +634,7 @@ valfun_4({bif,is_map_key,{f,Fail},[_Key,Map]=Ss,Dst}, Vst0) ->
valfun_4({bif,Op,{f,Fail},[Cons]=Ss,Dst}, Vst0)
when Op =:= hd; Op =:= tl ->
validate_src(Ss, Vst0),
- Vst1 = branch_state(Fail, Vst0),
- Vst = update_type(fun meet/2, cons, Cons, Vst1),
+ Vst = type_test(Fail, cons, Cons, Vst0),
Type = bif_type(Op, Ss, Vst),
extract_term(Type, Ss, Dst, Vst);
valfun_4({bif,Op,{f,Fail},Ss,Dst}, Vst0) ->