diff options
author | Björn Gustavsson <[email protected]> | 2012-02-09 13:29:24 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-02-09 13:29:24 +0100 |
commit | 0b45f106f19756bcef0ee51a8f5d4147dc253bcb (patch) | |
tree | 442a24fe05a9d2e998bd68e0060c7db77afb2d82 | |
parent | 4408f9f30a48fca6d51ecef6ba92ef2978f59e92 (diff) | |
parent | 8ddf2aa53544e01b26d7fd55ef68f80f4af6307d (diff) | |
download | otp-0b45f106f19756bcef0ee51a8f5d4147dc253bcb.tar.gz otp-0b45f106f19756bcef0ee51a8f5d4147dc253bcb.tar.bz2 otp-0b45f106f19756bcef0ee51a8f5d4147dc253bcb.zip |
Merge branch 'maint'
* maint:
Update primary bootstrap
HiPE: Remove support for is_constant/1
erl_lint: Remove handling of constant/1
erl_bif_types: Remove type for is_constant/1
erl_eval: Remove support for is_constant/1
Remove support for is_constant/1 in ms_transform
Remove references to is_constant/1 from the match spec documentation
Conflicts:
lib/hipe/cerl/erl_bif_types.erl
Also re-instate the type for erlang:is_boolean/1 which was
accidentally omitted in the master branch.
-rw-r--r-- | bootstrap/lib/stdlib/ebin/erl_eval.beam | bin | 23784 -> 23752 bytes | |||
-rw-r--r-- | bootstrap/lib/stdlib/ebin/erl_lint.beam | bin | 85144 -> 85064 bytes | |||
-rw-r--r-- | bootstrap/lib/stdlib/ebin/ms_transform.beam | bin | 20224 -> 20180 bytes | |||
-rw-r--r-- | erts/doc/src/match_spec.xml | 6 | ||||
-rw-r--r-- | lib/hipe/cerl/cerl_hipe_primops.hrl | 1 | ||||
-rw-r--r-- | lib/hipe/cerl/cerl_hipeify.erl | 1 | ||||
-rw-r--r-- | lib/hipe/cerl/cerl_messagean.erl | 1 | ||||
-rw-r--r-- | lib/hipe/cerl/cerl_to_icode.erl | 3 | ||||
-rw-r--r-- | lib/hipe/cerl/erl_bif_types.erl | 10 | ||||
-rw-r--r-- | lib/hipe/icode/hipe_beam_to_icode.erl | 4 | ||||
-rw-r--r-- | lib/hipe/icode/hipe_icode_inline_bifs.erl | 3 | ||||
-rw-r--r-- | lib/hipe/icode/hipe_icode_type.erl | 6 | ||||
-rw-r--r-- | lib/stdlib/doc/src/ms_transform.xml | 4 | ||||
-rw-r--r-- | lib/stdlib/src/erl_eval.erl | 1 | ||||
-rw-r--r-- | lib/stdlib/src/erl_lint.erl | 12 | ||||
-rw-r--r-- | lib/stdlib/src/ms_transform.erl | 2 | ||||
-rw-r--r-- | lib/stdlib/test/ms_transform_SUITE.erl | 5 |
17 files changed, 14 insertions, 45 deletions
diff --git a/bootstrap/lib/stdlib/ebin/erl_eval.beam b/bootstrap/lib/stdlib/ebin/erl_eval.beam Binary files differindex e646342e2b..6198c4f43a 100644 --- a/bootstrap/lib/stdlib/ebin/erl_eval.beam +++ b/bootstrap/lib/stdlib/ebin/erl_eval.beam diff --git a/bootstrap/lib/stdlib/ebin/erl_lint.beam b/bootstrap/lib/stdlib/ebin/erl_lint.beam Binary files differindex 6fa0884135..798924c19b 100644 --- a/bootstrap/lib/stdlib/ebin/erl_lint.beam +++ b/bootstrap/lib/stdlib/ebin/erl_lint.beam diff --git a/bootstrap/lib/stdlib/ebin/ms_transform.beam b/bootstrap/lib/stdlib/ebin/ms_transform.beam Binary files differindex f8689ddf72..bc16416161 100644 --- a/bootstrap/lib/stdlib/ebin/ms_transform.beam +++ b/bootstrap/lib/stdlib/ebin/ms_transform.beam diff --git a/erts/doc/src/match_spec.xml b/erts/doc/src/match_spec.xml index f0390c9db8..cd2b3abc1e 100644 --- a/erts/doc/src/match_spec.xml +++ b/erts/doc/src/match_spec.xml @@ -75,7 +75,7 @@ <item>MatchCondition ::= { GuardFunction } | { GuardFunction, ConditionExpression, ... } </item> - <item>BoolFunction ::= <c><![CDATA[is_atom]]></c> | <c><![CDATA[is_constant]]></c> | + <item>BoolFunction ::= <c><![CDATA[is_atom]]></c> | <c><![CDATA[is_float]]></c> | <c><![CDATA[is_integer]]></c> | <c><![CDATA[is_list]]></c> | <c><![CDATA[is_number]]></c> | <c><![CDATA[is_pid]]></c> | <c><![CDATA[is_port]]></c> | <c><![CDATA[is_reference]]></c> | <c><![CDATA[is_tuple]]></c> | <c><![CDATA[is_binary]]></c> | @@ -133,7 +133,7 @@ <item>MatchCondition ::= { GuardFunction } | { GuardFunction, ConditionExpression, ... } </item> - <item>BoolFunction ::= <c><![CDATA[is_atom]]></c> | <c><![CDATA[is_constant]]></c> | + <item>BoolFunction ::= <c><![CDATA[is_atom]]></c> | <c><![CDATA[is_float]]></c> | <c><![CDATA[is_integer]]></c> | <c><![CDATA[is_list]]></c> | <c><![CDATA[is_number]]></c> | <c><![CDATA[is_pid]]></c> | <c><![CDATA[is_port]]></c> | <c><![CDATA[is_reference]]></c> | <c><![CDATA[is_tuple]]></c> | <c><![CDATA[is_binary]]></c> | @@ -172,7 +172,7 @@ <title>Functions allowed in all types of match specifications</title> <p>The different functions allowed in <c><![CDATA[match_spec]]></c> work like this: </p> - <p><em>is_atom, is_constant, is_float, is_integer, is_list, is_number, is_pid, is_port, is_reference, is_tuple, is_binary, is_function: </em> Like the corresponding guard tests in + <p><em>is_atom, is_float, is_integer, is_list, is_number, is_pid, is_port, is_reference, is_tuple, is_binary, is_function: </em> Like the corresponding guard tests in Erlang, return <c><![CDATA[true]]></c> or <c><![CDATA[false]]></c>. </p> <p><em>is_record: </em>Takes an additional parameter, which SHALL diff --git a/lib/hipe/cerl/cerl_hipe_primops.hrl b/lib/hipe/cerl/cerl_hipe_primops.hrl index 36b1b62901..1d82f7bfc7 100644 --- a/lib/hipe/cerl/cerl_hipe_primops.hrl +++ b/lib/hipe/cerl/cerl_hipe_primops.hrl @@ -59,7 +59,6 @@ -define(PRIMOP_IS_ATOM, 'is_atom'). % arity 1 -define(PRIMOP_IS_BIGNUM, 'is_bignum'). % arity 1 -define(PRIMOP_IS_BINARY, 'is_binary'). % arity 1 --define(PRIMOP_IS_CONSTANT, 'is_constant'). % arity 1 -define(PRIMOP_IS_FIXNUM, 'is_fixnum'). % arity 1 -define(PRIMOP_IS_FLOAT, 'is_float'). % arity 1 -define(PRIMOP_IS_FUNCTION, 'is_function'). % arity 1 diff --git a/lib/hipe/cerl/cerl_hipeify.erl b/lib/hipe/cerl/cerl_hipeify.erl index 8f6c3561c9..89b4ec147d 100644 --- a/lib/hipe/cerl/cerl_hipeify.erl +++ b/lib/hipe/cerl/cerl_hipeify.erl @@ -392,7 +392,6 @@ call_to_primop(erlang, '=<', 2) -> {yes, ?PRIMOP_LE}; call_to_primop(erlang, '>=', 2) -> {yes, ?PRIMOP_GE}; call_to_primop(erlang, is_atom, 1) -> {yes, ?PRIMOP_IS_ATOM}; call_to_primop(erlang, is_binary, 1) -> {yes, ?PRIMOP_IS_BINARY}; -call_to_primop(erlang, is_constant, 1) -> {yes, ?PRIMOP_IS_CONSTANT}; call_to_primop(erlang, is_float, 1) -> {yes, ?PRIMOP_IS_FLOAT}; call_to_primop(erlang, is_function, 1) -> {yes, ?PRIMOP_IS_FUNCTION}; call_to_primop(erlang, is_integer, 1) -> {yes, ?PRIMOP_IS_INTEGER}; diff --git a/lib/hipe/cerl/cerl_messagean.erl b/lib/hipe/cerl/cerl_messagean.erl index 6dd93adaa3..b9f82f2a43 100644 --- a/lib/hipe/cerl/cerl_messagean.erl +++ b/lib/hipe/cerl/cerl_messagean.erl @@ -1083,7 +1083,6 @@ is_imm_op(erlang, is_alive, 0) -> true; is_imm_op(erlang, is_atom, 1) -> true; is_imm_op(erlang, is_binary, 1) -> true; is_imm_op(erlang, is_builtin, 3) -> true; -is_imm_op(erlang, is_constant, 1) -> true; is_imm_op(erlang, is_float, 1) -> true; is_imm_op(erlang, is_function, 1) -> true; is_imm_op(erlang, is_integer, 1) -> true; diff --git a/lib/hipe/cerl/cerl_to_icode.erl b/lib/hipe/cerl/cerl_to_icode.erl index 362c427cbe..089e3f021e 100644 --- a/lib/hipe/cerl/cerl_to_icode.erl +++ b/lib/hipe/cerl/cerl_to_icode.erl @@ -88,7 +88,6 @@ -define(TYPE_IS_ATOM, atom). -define(TYPE_IS_BIGNUM, bignum). -define(TYPE_IS_BINARY, binary). --define(TYPE_IS_CONSTANT, constant). -define(TYPE_IS_FIXNUM, fixnum). -define(TYPE_IS_FLOAT, float). -define(TYPE_IS_FUNCTION, function). @@ -2051,7 +2050,6 @@ is_record_test(T, A, N, True, False, Ctxt, Env, S) -> type_test(?PRIMOP_IS_ATOM) -> ?TYPE_IS_ATOM; type_test(?PRIMOP_IS_BIGNUM) -> ?TYPE_IS_BIGNUM; type_test(?PRIMOP_IS_BINARY) -> ?TYPE_IS_BINARY; -type_test(?PRIMOP_IS_CONSTANT) -> ?TYPE_IS_CONSTANT; type_test(?PRIMOP_IS_FIXNUM) -> ?TYPE_IS_FIXNUM; type_test(?PRIMOP_IS_FLOAT) -> ?TYPE_IS_FLOAT; type_test(?PRIMOP_IS_FUNCTION) -> ?TYPE_IS_FUNCTION; @@ -2082,7 +2080,6 @@ is_bool_op(Op, A) when is_atom(Op), is_integer(A) -> false. is_type_test(?PRIMOP_IS_ATOM, 1) -> true; is_type_test(?PRIMOP_IS_BIGNUM, 1) -> true; is_type_test(?PRIMOP_IS_BINARY, 1) -> true; -is_type_test(?PRIMOP_IS_CONSTANT, 1) -> true; is_type_test(?PRIMOP_IS_FIXNUM, 1) -> true; is_type_test(?PRIMOP_IS_FLOAT, 1) -> true; is_type_test(?PRIMOP_IS_FUNCTION, 1) -> true; diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl index b822f182c2..bb9dc44a0c 100644 --- a/lib/hipe/cerl/erl_bif_types.erl +++ b/lib/hipe/cerl/erl_bif_types.erl @@ -52,7 +52,6 @@ t_cons/2, t_cons_hd/1, t_cons_tl/1, - t_constant/0, t_fixnum/0, t_non_neg_fixnum/0, t_pos_fixnum/0, @@ -77,7 +76,6 @@ t_is_bitstr/1, t_is_boolean/1, t_is_cons/1, - t_is_constant/1, t_is_float/1, t_is_float/1, t_is_fun/1, @@ -584,11 +582,11 @@ type(erlang, is_bitstring, 1, Xs) -> check_guard(X, fun (Y) -> t_is_bitstr(Y) end, t_bitstr()) end, strict(arg_types(erlang, is_bitstring, 1), Xs, Fun); -type(erlang, is_constant, 1, Xs) -> +type(erlang, is_boolean, 1, Xs) -> Fun = fun (X) -> - check_guard(X, fun (Y) -> t_is_constant(Y) end, t_constant()) + check_guard(X, fun (Y) -> t_is_boolean(Y) end, t_boolean()) end, - strict(arg_types(erlang, is_constant, 1), Xs, Fun); + strict(arg_types(erlang, is_boolean, 1), Xs, Fun); type(erlang, is_float, 1, Xs) -> Fun = fun (X) -> check_guard(X, fun (Y) -> t_is_float(Y) end, t_float()) @@ -2228,8 +2226,6 @@ arg_types(erlang, is_bitstring, 1) -> [t_any()]; arg_types(erlang, is_boolean, 1) -> [t_any()]; -arg_types(erlang, is_constant, 1) -> - [t_any()]; arg_types(erlang, is_float, 1) -> [t_any()]; arg_types(erlang, is_function, 1) -> diff --git a/lib/hipe/icode/hipe_beam_to_icode.erl b/lib/hipe/icode/hipe_beam_to_icode.erl index 992f387bd5..2d2b414a70 100644 --- a/lib/hipe/icode/hipe_beam_to_icode.erl +++ b/lib/hipe/icode/hipe_beam_to_icode.erl @@ -465,10 +465,6 @@ trans_fun([{test,is_nil,{f,Lbl},[Arg]}|Instructions], Env) -> trans_fun([{test,is_binary,{f,Lbl},[Arg]}|Instructions], Env) -> {Code,Env1} = trans_type_test(binary,Lbl,Arg,Env), [Code | trans_fun(Instructions,Env1)]; -%%--- is_constant --- -trans_fun([{test,is_constant,{f,Lbl},[Arg]}|Instructions], Env) -> - {Code,Env1} = trans_type_test(constant,Lbl,Arg,Env), - [Code | trans_fun(Instructions,Env1)]; %%--- is_list --- trans_fun([{test,is_list,{f,Lbl},[Arg]}|Instructions], Env) -> {Code,Env1} = trans_type_test(list,Lbl,Arg,Env), diff --git a/lib/hipe/icode/hipe_icode_inline_bifs.erl b/lib/hipe/icode/hipe_icode_inline_bifs.erl index 27296dcad5..9a2fb7846a 100644 --- a/lib/hipe/icode/hipe_icode_inline_bifs.erl +++ b/lib/hipe/icode/hipe_icode_inline_bifs.erl @@ -29,7 +29,7 @@ %% Currently inlined BIFs: %% and, or, xor, not, <, >, >=, =<, ==, /=, =/=, =:= -%% is_atom, is_boolean, is_binary, is_constant, is_float, is_function, +%% is_atom, is_boolean, is_binary, is_float, is_function, %% is_integer, is_list, is_pid, is_port, is_reference, is_tuple -module(hipe_icode_inline_bifs). @@ -131,7 +131,6 @@ is_type_test(Name) -> is_boolean -> {true, boolean}; is_function -> {true, function}; is_reference -> {true, reference}; - is_constant -> {true, constant}; is_port -> {true, port}; _ -> false end. diff --git a/lib/hipe/icode/hipe_icode_type.erl b/lib/hipe/icode/hipe_icode_type.erl index 3f9488d7c3..cae4325b9e 100644 --- a/lib/hipe/icode/hipe_icode_type.erl +++ b/lib/hipe/icode/hipe_icode_type.erl @@ -899,9 +899,7 @@ test_type0(list, T) -> test_type0(cons, T) -> t_is_cons(T); test_type0(nil, T) -> - t_is_nil(T); -test_type0(constant, T) -> - t_is_constant(T). + t_is_nil(T). true_branch_info(integer) -> @@ -940,8 +938,6 @@ true_branch_info(nil) -> t_nil(); true_branch_info(boolean) -> t_boolean(); -true_branch_info(constant) -> - t_constant(); true_branch_info(T) -> exit({?MODULE,unknown_typetest,T}). diff --git a/lib/stdlib/doc/src/ms_transform.xml b/lib/stdlib/doc/src/ms_transform.xml index f81f8bda96..ad5f8bd5ac 100644 --- a/lib/stdlib/doc/src/ms_transform.xml +++ b/lib/stdlib/doc/src/ms_transform.xml @@ -308,7 +308,7 @@ ets:select(emp_tab, ets:fun2ms( Erlang code. Also arithmetics is allowed, as well as ordinary guard bif's. Here's a list of bif's and expressions:</p> <list type="bulleted"> - <item>The type tests: is_atom, is_constant, is_float, is_integer, + <item>The type tests: is_atom, is_float, is_integer, is_list, is_number, is_pid, is_port, is_reference, is_tuple, is_binary, is_function, is_record</item> <item>The boolean operators: not, and, or, andalso, orelse </item> @@ -318,7 +318,7 @@ ets:select(emp_tab, ets:fun2ms( <item>The guard bif's: abs, element, hd, length, node, round, size, tl, trunc, self</item> <item>The obsolete type test (only in guards): - atom, constant, float, integer, + atom, float, integer, list, number, pid, port, reference, tuple, binary, function, record</item> </list> diff --git a/lib/stdlib/src/erl_eval.erl b/lib/stdlib/src/erl_eval.erl index bf3c7b3504..95ba6b1096 100644 --- a/lib/stdlib/src/erl_eval.erl +++ b/lib/stdlib/src/erl_eval.erl @@ -947,7 +947,6 @@ type_test(integer) -> is_integer; type_test(float) -> is_float; type_test(number) -> is_number; type_test(atom) -> is_atom; -type_test(constant) -> is_constant; type_test(list) -> is_list; type_test(tuple) -> is_tuple; type_test(pid) -> is_pid; diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index cfbcf54d95..a1af0057ca 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -3436,17 +3436,11 @@ obsolete_guard({call,Line,{atom,Lr,F},As}, St0) -> false -> deprecated_function(Line, erlang, F, As, St0); true -> - St1 = case F of - constant -> - deprecated_function(Lr, erlang, is_constant, As, St0); - _ -> - St0 - end, - case is_warn_enabled(obsolete_guard, St1) of + case is_warn_enabled(obsolete_guard, St0) of true -> - add_warning(Lr,{obsolete_guard, {F, Arity}}, St1); + add_warning(Lr,{obsolete_guard, {F, Arity}}, St0); false -> - St1 + St0 end end; obsolete_guard(_G, St) -> diff --git a/lib/stdlib/src/ms_transform.erl b/lib/stdlib/src/ms_transform.erl index 63b397f3a5..4389fd457c 100644 --- a/lib/stdlib/src/ms_transform.erl +++ b/lib/stdlib/src/ms_transform.erl @@ -881,7 +881,6 @@ translate_language_element(Atom) -> end. old_bool_test(atom,1) -> is_atom; -old_bool_test(constant,1) -> is_constant; old_bool_test(float,1) -> is_float; old_bool_test(integer,1) -> is_integer; old_bool_test(list,1) -> is_list; @@ -896,7 +895,6 @@ old_bool_test(record,2) -> is_record; old_bool_test(_,_) -> undefined. bool_test(is_atom,1) -> true; -bool_test(is_constant,1) -> true; bool_test(is_float,1) -> true; bool_test(is_integer,1) -> true; bool_test(is_list,1) -> true; diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl index c9688354b1..a17307b07b 100644 --- a/lib/stdlib/test/ms_transform_SUITE.erl +++ b/lib/stdlib/test/ms_transform_SUITE.erl @@ -455,7 +455,6 @@ old_guards(Config) when is_list(Config) -> ?line setup(Config), Tests = [ {atom,is_atom}, - {constant,is_constant}, {float,is_float}, {integer,is_integer}, {list,is_list}, @@ -490,7 +489,6 @@ old_guards(Config) when is_list(Config) -> ?line [{'$1',[{is_integer,'$1'}, {is_float,'$1'}, {is_atom,'$1'}, - {is_constant,'$1'}, {is_list,'$1'}, {is_number,'$1'}, {is_pid,'$1'}, @@ -502,7 +500,7 @@ old_guards(Config) when is_list(Config) -> [true]}] = compile_and_run(RD, << "ets:fun2ms(fun(X) when integer(X)," - "float(X), atom(X), constant(X)," + "float(X), atom(X)," "list(X), number(X), pid(X)," "port(X), reference(X), tuple(X)," "binary(X), record(X,a) -> true end)" @@ -530,7 +528,6 @@ autoimported(Config) when is_list(Config) -> {self,0}, %{float,1}, see float_1_function/1 {is_atom,1}, - {is_constant,1}, {is_float,1}, {is_integer,1}, {is_list,1}, |