aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-10-08 13:04:40 +0200
committerBjörn Gustavsson <[email protected]>2015-10-09 10:31:19 +0200
commit93f5844185a459cbf9efc3843919c463a2eef0fe (patch)
tree4188b1ce168a8d4d432646d061f11c315c1cf9ba /lib/tools
parent5472eb516e969f7f9ac50ab57b195e5b043e1d79 (diff)
downloadotp-93f5844185a459cbf9efc3843919c463a2eef0fe.tar.gz
otp-93f5844185a459cbf9efc3843919c463a2eef0fe.tar.bz2
otp-93f5844185a459cbf9efc3843919c463a2eef0fe.zip
Teach erlang:is_builtin/3 that erlang:apply/3 is built-in
erlang:is_builtin(erlang, apply, 3) returns 'false'. That seems to be an oversight in the implementation of erlang:is_builtin/3 rather than a conscious design decision. Part of apply/3 is implemented in C (as a special instruction), and part of it in Erlang (only used if apply/3 is used recursively). That makes apply/3 special compared to all other BIFs. From the viewpoint of the user, apply/3 is a built-in function, since it cannot possibly be implemented in pure Erlang. Noticed-by: Stavros Aronis
Diffstat (limited to 'lib/tools')
-rw-r--r--lib/tools/test/xref_SUITE.erl28
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl
index ad47b31443..71c8b1a277 100644
--- a/lib/tools/test/xref_SUITE.erl
+++ b/lib/tools/test/xref_SUITE.erl
@@ -1151,17 +1151,13 @@ read_expected(Version) ->
{POS8+4,{FF,{a,b,1}}},
{POS8+4,{FF,{erlang,apply,2}}},
{POS8+5,{FF,{erlang,apply,2}}},
- {POS8+6,{FF,{erlang,apply,3}}},
{POS8+6,{FF,{m,f,1}}},
- {POS8+7,{FF,{erlang,apply,3}}},
- {POS9+1,{FF,{erlang,apply,3}}},
{POS9+1,{FF,{read,bi,0}}},
{POS9+2,{FF,{a,b,1}}},
{POS9+2,{FF,{erlang,apply,2}}},
{POS9+3,{FF,{erlang,apply,2}}},
{POS9+4,{FF,{erlang,apply,2}}},
{POS9+4,{FF,{erlang,not_a_function,1}}},
- {POS9+5,{FF,{erlang,apply,3}}},
{POS9+5,{FF,{mod,func,2}}},
{POS9+6,{FF,{erlang,apply,1}}},
{POS9+7,{FF,{erlang,apply,2}}},
@@ -1169,17 +1165,11 @@ read_expected(Version) ->
{POS9+8,{FF,{q,f,1}}},
{POS10+4,{FF,{erlang,apply,2}}},
{POS10+5,{FF,{mod1,fun1,1}}},
- {POS11+1,{FF,{erlang,apply,3}}},
- {POS11+2,{FF,{erlang,apply,3}}},
- {POS11+3,{FF,{erlang,apply,3}}},
- {POS11+4,{FF,{erlang,apply,3}}},
{POS11+6,{FF,{erlang,apply,2}}},
{POS12+1,{FF,{erlang,apply,2}}},
{POS12+4,{FF,{erlang,apply,2}}},
- {POS12+5,{FF,{erlang,apply,3}}},
{POS12+5,{FF,{m3,f3,2}}},
{POS12+7,{FF,{erlang,apply,2}}},
- {POS12+8,{FF,{erlang,apply,3}}},
{POS13+1,{FF,{dm,df,1}}},
{POS13+6,{{read,bi,0},{foo,module_info,0}}},
{POS13+7,{{read,bi,0},{read,module_info,0}}},
@@ -1189,10 +1179,6 @@ read_expected(Version) ->
OK = case Version of
abstract_v1 ->
- [{POS8+3, {FF,{erlang,apply,3}}},
- {POS10+1, {FF,{erlang,apply,3}}},
- {POS10+6, {FF,{erlang,apply,3}}}]
- ++
[{0,{FF,{read,'$F_EXPR',178}}},
{0,{FF,{modul,'$F_EXPR',179}}}]
++ O1;
@@ -1213,13 +1199,25 @@ read_expected(Version) ->
{POS3+3, {FF,{erlang,spawn_link,3}}},
{POS3+4, {FF,{erlang,spawn_link,3}}},
{POS6+4, {FF,{erlang,spawn,3}}},
+ {POS8+6,{FF,{erlang,apply,3}}},
+ {POS8+7,{FF,{erlang,apply,3}}},
+ {POS9+1,{FF,{erlang,apply,3}}},
+ {POS9+5,{FF,{erlang,apply,3}}},
+ {POS11+1,{FF,{erlang,apply,3}}},
+ {POS11+2,{FF,{erlang,apply,3}}},
+ {POS11+3,{FF,{erlang,apply,3}}},
+ {POS11+4,{FF,{erlang,apply,3}}},
+ {POS12+5,{FF,{erlang,apply,3}}},
+ {POS12+8,{FF,{erlang,apply,3}}},
{POS13+5, {{read,bi,0},{erlang,length,1}}},
{POS14+3, {{read,bi,0},{erlang,length,1}}}],
%% Operators (OTP-8647):
OKB = case Version of
abstract_v1 ->
- [];
+ [{POS8+3, {FF,{erlang,apply,3}}},
+ {POS10+1, {FF,{erlang,apply,3}}},
+ {POS10+6, {FF,{erlang,apply,3}}}];
_ ->
[{POS13+16, {{read,bi,0},{erlang,'!',2}}},
{POS13+16, {{read,bi,0},{erlang,'-',1}}},