diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2013-01-28 15:41:18 +0100 |
---|---|---|
committer | Björn Gustavsson <bjorn@erlang.org> | 2013-01-31 11:14:47 +0100 |
commit | e5d592e8258095a49d112fafeb5d67e85d196727 (patch) | |
tree | b0d86465785f7d5681fee212b6ce0daf1230ecff /lib/stdlib/src/erl_lint.erl | |
parent | e26788bf716eab7dfbfc6a1ea000b5d428a99c40 (diff) | |
download | otp-e5d592e8258095a49d112fafeb5d67e85d196727.tar.gz otp-e5d592e8258095a49d112fafeb5d67e85d196727.tar.bz2 otp-e5d592e8258095a49d112fafeb5d67e85d196727.zip |
Remove error handling for calling a BIF that is not auto-imported
All guards BIFs are auto-imported. That can be verified like this:
[] = [{F,A} || {erlang,F,A} <- erlang:system_info(snifs),
erl_internal:guard_bif(F, A),
not erl_internal:bif(F, A)]
Therefore, calling a guard BIF in a guard without a module name
is always allowed (provided that there is not a local function or
an import with the same name), and therefore we can remove the
error reporting code. But keep an assertion so that we will find
out if any non-auto-imported guard BIFs are added in the future.
Diffstat (limited to 'lib/stdlib/src/erl_lint.erl')
-rw-r--r-- | lib/stdlib/src/erl_lint.erl | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index deae9640f5..d50172ca50 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -236,11 +236,6 @@ format_error({illegal_guard_local_call, {F,A}}) -> io_lib:format("call to local/imported function ~w/~w is illegal in guard", [F,A]); format_error(illegal_guard_expr) -> "illegal guard expression"; -%% --- exports --- -format_error({explicit_export,F,A}) -> - io_lib:format("in this release, the call to ~w/~w must be written " - "like this: erlang:~w/~w", - [F,A,F,A]); %% --- records --- format_error({undefined_record,T}) -> io_lib:format("record ~w undefined", [T]); @@ -1798,11 +1793,9 @@ gexpr({call,Line,{atom,_La,F},As}, Vt, St0) -> %% BifClash - Function called in guard case erl_internal:guard_bif(F, A) andalso no_guard_bif_clash(St1,{F,A}) of true -> - %% Also check that it is auto-imported. - case erl_internal:bif(F, A) of - true -> {Asvt,St1}; - false -> {Asvt,add_error(Line, {explicit_export,F,A}, St1)} - end; + %% Assert that it is auto-imported. + true = erl_internal:bif(F, A), + {Asvt,St1}; false -> case is_local_function(St1#lint.locals,{F,A}) orelse is_imported_function(St1#lint.imports,{F,A}) of |