diff options
author | Erlang/OTP <[email protected]> | 2010-06-02 13:15:16 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-06-02 13:15:16 +0000 |
commit | a2b84aa66d96ac3f808ca60d2de072992fdb1410 (patch) | |
tree | 449a23f20a4c0c263b9eee2329d4b9a9951ee904 | |
parent | 841de5287ecef4dae5ea2e78531d8216f9b87989 (diff) | |
parent | a62abc91b5f95fc9137d42867e1429867a77bf4e (diff) | |
download | otp-a2b84aa66d96ac3f808ca60d2de072992fdb1410.tar.gz otp-a2b84aa66d96ac3f808ca60d2de072992fdb1410.tar.bz2 otp-a2b84aa66d96ac3f808ca60d2de072992fdb1410.zip |
Merge branch 'jv/autoimport-binary_to_term_2' into dev
* jv/autoimport-binary_to_term_2:
Change binary_to_term/2 to be auto-imported
OTP-8671 jv/autoimport-binary_to_term_2
Now, binary_to_term/2 is auto-imported. This will cause a compile warning
if and only if a module has got a local function with that name.
-rw-r--r-- | erts/doc/src/erlang.xml | 2 | ||||
-rw-r--r-- | erts/emulator/test/binary_SUITE.erl | 10 | ||||
-rw-r--r-- | lib/stdlib/src/erl_internal.erl | 1 |
3 files changed, 7 insertions, 6 deletions
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index e683f161f1..c3c0dd77d7 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -407,7 +407,7 @@ iolist() = [char() | binary() | iolist()] </desc> </func> <func> - <name>erlang:binary_to_term(Binary, Opts) -> term()</name> + <name>binary_to_term(Binary, Opts) -> term()</name> <fsummary>Decode an Erlang external term format binary</fsummary> <type> <v>Opts = [safe]</v> diff --git a/erts/emulator/test/binary_SUITE.erl b/erts/emulator/test/binary_SUITE.erl index 7ecc31aa29..77d2579848 100644 --- a/erts/emulator/test/binary_SUITE.erl +++ b/erts/emulator/test/binary_SUITE.erl @@ -438,11 +438,11 @@ terms(Config) when is_list(Config) -> ok end, Term = binary_to_term(Bin), - Term = erlang:binary_to_term(Bin, [safe]), + Term = binary_to_term(Bin, [safe]), Unaligned = make_unaligned_sub_binary(Bin), Term = binary_to_term(Unaligned), - Term = erlang:binary_to_term(Unaligned, []), - Term = erlang:binary_to_term(Bin, [safe]), + Term = binary_to_term(Unaligned, []), + Term = binary_to_term(Bin, [safe]), BinC = erlang:term_to_binary(Term, [compressed]), Term = binary_to_term(BinC), true = size(BinC) =< size(Bin), @@ -542,7 +542,7 @@ bad_bin_to_term(BadBin) -> {'EXIT',{badarg,_}} = (catch binary_to_term(BadBin)). bad_bin_to_term(BadBin,Opts) -> - {'EXIT',{badarg,_}} = (catch erlang:binary_to_term(BadBin,Opts)). + {'EXIT',{badarg,_}} = (catch binary_to_term(BadBin,Opts)). safe_binary_to_term2(doc) -> "Test safety options for binary_to_term/2"; safe_binary_to_term2(Config) when is_list(Config) -> @@ -553,7 +553,7 @@ safe_binary_to_term2(Config) when is_list(Config) -> BadRef = <<131,114,0,3,BadHostAtom/binary,0,<<0,0,0,255>>/binary, Empty/binary,Empty/binary>>, ?line bad_bin_to_term(BadRef, [safe]), % good ref, with a bad atom - ?line fullsweep_after = erlang:binary_to_term(<<131,100,0,15,"fullsweep_after">>, [safe]), % should be a good atom + ?line fullsweep_after = binary_to_term(<<131,100,0,15,"fullsweep_after">>, [safe]), % should be a good atom BadExtFun = <<131,113,100,0,4,98,108,117,101,100,0,4,109,111,111,110,97,3>>, ?line bad_bin_to_term(BadExtFun, [safe]), ok. diff --git a/lib/stdlib/src/erl_internal.erl b/lib/stdlib/src/erl_internal.erl index 2471c545dd..f78d8dc609 100644 --- a/lib/stdlib/src/erl_internal.erl +++ b/lib/stdlib/src/erl_internal.erl @@ -238,6 +238,7 @@ bif(binary_to_existing_atom, 2) -> true; bif(binary_to_list, 1) -> true; bif(binary_to_list, 3) -> true; bif(binary_to_term, 1) -> true; +bif(binary_to_term, 2) -> true; bif(bitsize, 1) -> true; bif(bit_size, 1) -> true; bif(bitstring_to_list, 1) -> true; |