aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-31 11:53:32 +0200
committerSverker Eriksson <[email protected]>2016-05-31 11:53:32 +0200
commit0e40609c64538a58466de8cddf2a7f0aebaf65ef (patch)
treec209d18d6a6fcfb9d292b42fc57405bd1ecea474
parent8305c497ffff7ccf7cb06635a18c84b3eb3c859f (diff)
parentd319179eee6a523812c81c7ca49afb670de0b277 (diff)
downloadotp-0e40609c64538a58466de8cddf2a7f0aebaf65ef.tar.gz
otp-0e40609c64538a58466de8cddf2a7f0aebaf65ef.tar.bz2
otp-0e40609c64538a58466de8cddf2a7f0aebaf65ef.zip
Merge branch 'sverker/dialyzer/erlang-halt'
-rw-r--r--erts/emulator/test/bif_SUITE.erl13
-rw-r--r--erts/preloaded/src/erlang.erl3
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl6
3 files changed, 18 insertions, 4 deletions
diff --git a/erts/emulator/test/bif_SUITE.erl b/erts/emulator/test/bif_SUITE.erl
index ec6cb6ab72..d31399e4af 100644
--- a/erts/emulator/test/bif_SUITE.erl
+++ b/erts/emulator/test/bif_SUITE.erl
@@ -141,9 +141,11 @@ guard_bifs_in_erl_bif_types(_Config) ->
shadow_comments(_Config) ->
ensure_erl_bif_types_compiled(),
+ ErlangList = [{erlang,F,A} || {F,A} <- erlang:module_info(exports),
+ not is_operator(F,A)],
List0 = erlang:system_info(snifs),
- List1 = [MFA || {M,_,_}=MFA <- List0, M =/= hipe_bifs],
- List = [MFA || MFA <- List1, not is_operator(MFA)],
+ List1 = [MFA || {M,_,_}=MFA <- List0, M =/= hipe_bifs, M =/= erlang],
+ List = List1 ++ ErlangList,
HasTypes = [MFA || {M,F,A}=MFA <- List,
erl_bif_types:is_known(M, F, A)],
Path = get_code_path(),
@@ -253,12 +255,15 @@ specs(_) ->
end.
is_operator({erlang,F,A}) ->
+ is_operator(F,A);
+is_operator(_) -> false.
+
+is_operator(F,A) ->
erl_internal:arith_op(F, A) orelse
erl_internal:bool_op(F, A) orelse
erl_internal:comp_op(F, A) orelse
erl_internal:list_op(F, A) orelse
- erl_internal:send_op(F, A);
-is_operator(_) -> false.
+ erl_internal:send_op(F, A).
extract_specs(M, Abstr) ->
[{make_mfa(M, Name),Spec} || {attribute,_,spec,{Name,Spec}} <- Abstr].
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl
index 5283519c0a..94f3078173 100644
--- a/erts/preloaded/src/erlang.erl
+++ b/erts/preloaded/src/erlang.erl
@@ -977,11 +977,13 @@ group_leader(_GroupLeader, _Pid) ->
erlang:nif_error(undefined).
%% halt/0
+%% Shadowed by erl_bif_types: erlang:halt/0
-spec halt() -> no_return().
halt() ->
erlang:halt(0, []).
%% halt/1
+%% Shadowed by erl_bif_types: erlang:halt/1
-spec halt(Status) -> no_return() when
Status :: non_neg_integer() | 'abort' | string().
halt(Status) ->
@@ -2576,6 +2578,7 @@ universaltime_to_localtime(_Universaltime) ->
%%--------------------------------------------------------------------------
+%% Shadowed by erl_bif_types: erlang:apply/2
-spec apply(Fun, Args) -> term() when
Fun :: function(),
Args :: [term()].
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index f649c6e599..9453ca6c6f 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -154,6 +154,8 @@ type(M, F, A, Xs) ->
erl_types:erl_type().
%%-- erlang -------------------------------------------------------------------
+type(erlang, halt, 0, _, _) -> t_none();
+type(erlang, halt, 1, _, _) -> t_none();
type(erlang, halt, 2, _, _) -> t_none();
type(erlang, exit, 1, _, _) -> t_none();
type(erlang, error, 1, _, _) -> t_none();
@@ -2339,6 +2341,10 @@ arg_types(erlang, bit_size, 1) ->
%% Guard bif, needs to be here.
arg_types(erlang, byte_size, 1) ->
[t_bitstr()];
+arg_types(erlang, halt, 0) ->
+ [];
+arg_types(erlang, halt, 1) ->
+ [t_sup([t_non_neg_fixnum(), t_atom('abort'), t_string()])];
arg_types(erlang, halt, 2) ->
[t_sup([t_non_neg_fixnum(), t_atom('abort'), t_string()]),
t_list(t_tuple([t_atom('flush'), t_boolean()]))];