aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
diff options
context:
space:
mode:
authorJosé Valim <[email protected]>2013-10-18 12:05:46 +0200
committerJosé Valim <[email protected]>2013-10-18 12:37:35 +0200
commitd2b412df6c8751c10de025399cb04a8194169d0d (patch)
tree8e7917590f4beb60302ed6c7ffa32a476b55c263 /lib/stdlib/test
parent73d1b4a1cc5ef1898b650fc74063ab28bc85bcbf (diff)
downloadotp-d2b412df6c8751c10de025399cb04a8194169d0d.tar.gz
otp-d2b412df6c8751c10de025399cb04a8194169d0d.tar.bz2
otp-d2b412df6c8751c10de025399cb04a8194169d0d.zip
Allow all auto imports to be suppressed at once
This patch introduces the no_auto_import attribute: -compile(no_auto_import). Useful for code generation tools that always use the qualified function names and want to avoid the auto imported functions clashing with local ones. Implementation wise, we chose to have a special flag 'all' to avoid doing many set lookups when checking for suppression.
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index 48ddeac478..c1978d6561 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -2742,7 +2742,24 @@ bif_clash(Config) when is_list(Config) ->
{6,erl_lint,{illegal_guard_local_call,{is_tuple,1}}},
{7,erl_lint,{illegal_guard_local_call,{is_list,1}}},
{8,erl_lint,{illegal_guard_local_call,{is_record,3}}},
- {9,erl_lint,{illegal_guard_local_call,{is_record,3}}}],[]}}
+ {9,erl_lint,{illegal_guard_local_call,{is_record,3}}}],[]}},
+ %% We can also suppress all auto imports at once
+ {clash22,
+ <<"-export([size/1, binary_part/2]).
+ -compile(no_auto_import).
+ size([]) ->
+ 0;
+ size({N,_}) ->
+ N;
+ size([_|T]) ->
+ 1+size(T).
+ binary_part({B,_},{X,Y}) ->
+ binary_part(B,{X,Y});
+ binary_part(B,{X,Y}) ->
+ binary:part(B,X,Y).
+ ">>,
+ [],
+ []}
],
?line [] = run(Config, Ts),