aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl/erl_bif_types.erl
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2010-02-10 11:03:35 +0200
committerBjörn Gustavsson <[email protected]>2010-02-14 12:23:03 +0100
commita9c8a2496d54668d2d46133ff0ef1787cd7b80d6 (patch)
tree3bfcb5f41342f4c48bc2affcf90214182bee2495 /lib/hipe/cerl/erl_bif_types.erl
parentcdd3a82020d7c6d0d9a3fe35469d66809685ddf5 (diff)
downloadotp-a9c8a2496d54668d2d46133ff0ef1787cd7b80d6.tar.gz
otp-a9c8a2496d54668d2d46133ff0ef1787cd7b80d6.tar.bz2
otp-a9c8a2496d54668d2d46133ff0ef1787cd7b80d6.zip
dialyzer: New version for the R13B04 release
Diffstat (limited to 'lib/hipe/cerl/erl_bif_types.erl')
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl31
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index 8aa2cc76c7..ee0ddd6915 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -102,6 +102,7 @@
t_list_elements/1,
t_list_termination/1,
t_mfa/0,
+ t_module/0,
t_nil/0,
t_node/0,
t_none/0,
@@ -694,6 +695,8 @@ type(erlang, binary_to_list, 3, Xs) ->
fun (_) -> t_list(t_byte()) end);
type(erlang, binary_to_term, 1, Xs) ->
strict(arg_types(erlang, binary_to_term, 1), Xs, fun (_) -> t_any() end);
+type(erlang, binary_to_term, 2, Xs) ->
+ strict(arg_types(erlang, binary_to_term, 2), Xs, fun (_) -> t_any() end);
type(erlang, bitsize, 1, Xs) -> % XXX: TAKE OUT
type(erlang, bit_size, 1, Xs);
type(erlang, bit_size, 1, Xs) ->
@@ -3127,20 +3130,20 @@ arith(Op, X1, X2) ->
end,
%% io:format("done arith ~p = ~p~n", [Op, {NewMin, NewMax}]),
{ok, t_from_range(NewMin, NewMax)};
- false ->
+ false ->
%% Some of these arithmetic operations might throw a system_limit
%% exception; for example, when trying to evaluate 1 bsl 100000000.
try case Op of
- '+' -> [X + Y || X <- L1, Y <- L2];
- '-' -> [X - Y || X <- L1, Y <- L2];
- '*' -> [X * Y || X <- L1, Y <- L2];
- 'div' -> [X div Y || X <- L1, Y <- L2,Y =/= 0];
- 'rem' -> [X rem Y || X <- L1, Y <- L2,Y =/= 0];
- 'bsl' -> [X bsl Y || X <- L1, Y <- L2];
- 'bsr' -> [X bsr Y || X <- L1, Y <- L2];
- 'band' -> [X band Y || X <- L1, Y <- L2];
- 'bor' -> [X bor Y || X <- L1, Y <- L2];
- 'bxor' -> [X bxor Y || X <- L1, Y <- L2]
+ '+' -> [X + Y || X <- L1, Y <- L2];
+ '-' -> [X - Y || X <- L1, Y <- L2];
+ '*' -> [X * Y || X <- L1, Y <- L2];
+ 'div' -> [X div Y || X <- L1, Y <- L2, Y =/= 0];
+ 'rem' -> [X rem Y || X <- L1, Y <- L2, Y =/= 0];
+ 'bsl' -> [X bsl Y || X <- L1, Y <- L2];
+ 'bsr' -> [X bsr Y || X <- L1, Y <- L2];
+ 'band' -> [X band Y || X <- L1, Y <- L2];
+ 'bor' -> [X bor Y || X <- L1, Y <- L2];
+ 'bxor' -> [X bxor Y || X <- L1, Y <- L2]
end of
AllVals ->
{ok, t_integers(ordsets:from_list(AllVals))}
@@ -3338,8 +3341,7 @@ arg_types(erlang, abs, 1) ->
arg_types(erlang, append_element, 2) ->
[t_tuple(), t_any()];
arg_types(erlang, apply, 2) ->
- [t_sup(t_tuple([t_sup(t_atom(), % module name
- t_tuple()), % parameterized module
+ [t_sup(t_tuple([t_module(),
t_atom()]),
t_fun()),
t_list()];
@@ -3359,6 +3361,8 @@ arg_types(erlang, binary_to_list, 3) ->
[t_binary(), t_pos_integer(), t_pos_integer()]; % I want fixnum, but cannot
arg_types(erlang, binary_to_term, 1) ->
[t_binary()];
+arg_types(erlang, binary_to_term, 2) ->
+ [t_binary(), t_list(t_atom('safe'))];
arg_types(erlang, bitsize, 1) -> % XXX: TAKE OUT
arg_types(erlang, bit_size, 1);
arg_types(erlang, bit_size, 1) ->
@@ -4351,6 +4355,7 @@ structure_inspecting_args(erlang, is_pid, 1) -> [1];
structure_inspecting_args(erlang, is_port, 1) -> [1];
structure_inspecting_args(erlang, is_reference, 1) -> [1];
structure_inspecting_args(erlang, is_tuple, 1) -> [1];
+structure_inspecting_args(erlang, length, 1) -> [1];
%%structure_inspecting_args(erlang, setelement, 3) -> [2].
structure_inspecting_args(_, _, _) -> []. % XXX: assume no arg needs inspection