diff options
author | John Högberg <[email protected]> | 2019-05-29 16:11:46 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-06-12 15:03:46 +0200 |
commit | 48f83e165a2dae8ed04a74ba3c6308250168f790 (patch) | |
tree | 95c292f7c74aedad0c0bd75b64eec38698dd7dba /lib/compiler/src/beam_call_types.erl | |
parent | 4411b1953bfb862aad433c2269acb82a35b0cc72 (diff) | |
download | otp-48f83e165a2dae8ed04a74ba3c6308250168f790.tar.gz otp-48f83e165a2dae8ed04a74ba3c6308250168f790.tar.bz2 otp-48f83e165a2dae8ed04a74ba3c6308250168f790.zip |
beam_validator: Replace old type representation with beam_types
Diffstat (limited to 'lib/compiler/src/beam_call_types.erl')
-rw-r--r-- | lib/compiler/src/beam_call_types.erl | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl index b1ff200fb6..d091b7866d 100644 --- a/lib/compiler/src/beam_call_types.erl +++ b/lib/compiler/src/beam_call_types.erl @@ -24,7 +24,39 @@ -import(lists, [duplicate/2,foldl/3]). --export([types/3]). +-export([never_throws/3, types/3]). + +-spec never_throws(Mod, Func, Arity) -> boolean() when + Mod :: atom(), + Func :: atom(), + Arity :: non_neg_integer(). + +never_throws(erlang, '/=', 2) -> true; +never_throws(erlang, '<', 2) -> true; +never_throws(erlang, '=/=', 2) -> true; +never_throws(erlang, '=:=', 2) -> true; +never_throws(erlang, '=<', 2) -> true; +never_throws(erlang, '==', 2) -> true; +never_throws(erlang, '>', 2) -> true; +never_throws(erlang, '>=', 2) -> true; +never_throws(erlang, is_atom, 1) -> true; +never_throws(erlang, is_boolean, 1) -> true; +never_throws(erlang, is_binary, 1) -> true; +never_throws(erlang, is_bitstring, 1) -> true; +never_throws(erlang, is_float, 1) -> true; +never_throws(erlang, is_function, 1) -> true; +never_throws(erlang, is_integer, 1) -> true; +never_throws(erlang, is_list, 1) -> true; +never_throws(erlang, is_map, 1) -> true; +never_throws(erlang, is_number, 1) -> true; +never_throws(erlang, is_pid, 1) -> true; +never_throws(erlang, is_port, 1) -> true; +never_throws(erlang, is_reference, 1) -> true; +never_throws(erlang, is_tuple, 1) -> true; +never_throws(erlang, get, 1) -> true; +never_throws(erlang, self, 0) -> true; +never_throws(erlang, node, 0) -> true; +never_throws(_, _, _) -> false. %% %% Returns the inferred return and argument types for known functions, and |