diff options
author | Kostis Sagonas <[email protected]> | 2010-10-02 17:56:00 +0300 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2010-10-02 17:56:00 +0300 |
commit | 56916f360771eaec3490a2b2c8e1560d190619a1 (patch) | |
tree | f2f8c5cc2e32e2054de1ee154c86ed7123689596 /lib/hipe | |
parent | dd51118499209bbd91c0092d9778897026bde4c6 (diff) | |
download | otp-56916f360771eaec3490a2b2c8e1560d190619a1.tar.gz otp-56916f360771eaec3490a2b2c8e1560d190619a1.tar.bz2 otp-56916f360771eaec3490a2b2c8e1560d190619a1.zip |
Fix type of ets:update_counter/3 to correspond with the documentation
Diffstat (limited to 'lib/hipe')
-rw-r--r-- | lib/hipe/cerl/erl_bif_types.erl | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index 6eeeab3610..835f9a205a 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -1219,7 +1219,7 @@ type(erlang, monitor_node, 3, Xs) -> strict(arg_types(erlang, monitor_node, 3), Xs, fun (_) -> t_atom('true') end); type(erlang, nif_error, 1, _) -> - t_any(); + t_any(); % this BIF and the next one are stubs for NIFs and never return type(erlang, nif_error, 2, Xs) -> strict(arg_types(erlang, nif_error, 2), Xs, fun (_) -> t_any() end); type(erlang, node, 0, _) -> t_node(); @@ -1970,7 +1970,25 @@ type(ets, slot, 2, Xs) -> strict(arg_types(ets, slot, 2), Xs, fun (_) -> t_sup(t_list(t_tuple()), t_atom('$end_of_table')) end); type(ets, update_counter, 3, Xs) -> - strict(arg_types(ets, update_counter, 3), Xs, fun (_) -> t_integer() end); + strict(arg_types(ets, update_counter, 3), Xs, + fun ([_, _, Op]) -> + case t_is_integer(Op) of + true -> t_integer(); + false -> + case t_is_tuple(Op) of + true -> t_integer(); + false -> + case t_is_list(Op) of + true -> t_list(t_integer()); + false -> + case t_is_nil(Op) of + true -> t_nil(); + false -> t_sup([t_integer(), t_list(t_integer())]) + end + end + end + end + end); type(ets, update_element, 3, Xs) -> strict(arg_types(ets, update_element, 3), Xs, fun (_) -> t_boolean() end); %%-- file --------------------------------------------------------------------- @@ -4181,10 +4199,9 @@ arg_types(ets, setopts, 2) -> t_tuple([t_atom('heir'), t_atom('none')])), [t_tab(), t_sup(Opt, t_list(Opt))]; arg_types(ets, update_counter, 3) -> - [t_tab(), t_any(), t_sup(t_integer(), - t_sup(t_tuple([t_integer(), t_integer()]), - t_tuple([t_integer(), t_integer(), - t_integer(), t_integer()])))]; + Int = t_integer(), + UpdateOp = t_sup(t_tuple([Int, Int]), t_tuple([Int, Int, Int, Int])), + [t_tab(), t_any(), t_sup([UpdateOp, t_list(UpdateOp), Int])]; arg_types(ets, update_element, 3) -> PosValue = t_tuple([t_integer(), t_any()]), [t_tab(), t_any(), t_sup(PosValue, t_list(PosValue))]; |