aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-03-06 10:14:27 +0100
committerJohn Högberg <[email protected]>2019-03-06 10:23:11 +0100
commite2ba1311d8c7de4901d0296b3508c623ce9538e4 (patch)
treef4bb42ceac97e366bfa1edce1a5bbf3e5bbe4706 /lib/compiler
parent22daa7e4f0143b3c18642dd50822295d6cb8923a (diff)
downloadotp-e2ba1311d8c7de4901d0296b3508c623ce9538e4.tar.gz
otp-e2ba1311d8c7de4901d0296b3508c623ce9538e4.tar.bz2
otp-e2ba1311d8c7de4901d0296b3508c623ce9538e4.zip
beam_validator: Express test_arity/is_tagged_tuple as type tests
This ensures that unreachable branches are properly ignored on repeated checks (although tuple type subtraction isn't complete yet).
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/beam_validator.erl14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index de1a87039b..ab8caa1a0d 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -902,18 +902,12 @@ valfun_4({test,is_nil,{f,Lbl},[Src]}, Vst) ->
end);
valfun_4({test,test_arity,{f,Lbl},[Tuple,Sz]}, Vst) when is_integer(Sz) ->
assert_type(tuple, Tuple, Vst),
- branch(Lbl, Vst,
- fun(SuccVst) ->
- Type = {tuple, Sz, #{}},
- update_type(fun meet/2, Type, Tuple, SuccVst)
- end);
+ Type = {tuple, Sz, #{}},
+ type_test(Lbl, Type, Tuple, Vst);
valfun_4({test,is_tagged_tuple,{f,Lbl},[Src,Sz,Atom]}, Vst) ->
assert_term(Src, Vst),
- branch(Lbl, Vst,
- fun(SuccVst) ->
- Type = {tuple, Sz, #{ {integer,1} => Atom }},
- update_type(fun meet/2, Type, Src, SuccVst)
- end);
+ Type = {tuple, Sz, #{ {integer,1} => Atom }},
+ type_test(Lbl, Type, Src, Vst);
valfun_4({test,is_eq_exact,{f,Lbl},[Src,Val]=Ss}, Vst) ->
validate_src(Ss, Vst),
branch(Lbl, Vst,