aboutsummaryrefslogtreecommitdiffstats
path: root/plt
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-05-21 17:01:53 +0200
committerPatrik Nyblom <[email protected]>2010-06-02 16:47:22 +0200
commit7f04467044c509f6a0c39fd5bc31623d440c3715 (patch)
tree23f148807e22916baf092e1270951a6faf6559c2 /plt
parenta4894eabd2117dbb8e98365e9f87acf8c7a1ae33 (diff)
downloadotp-7f04467044c509f6a0c39fd5bc31623d440c3715.tar.gz
otp-7f04467044c509f6a0c39fd5bc31623d440c3715.tar.bz2
otp-7f04467044c509f6a0c39fd5bc31623d440c3715.zip
Teach erl_lint to better override BIFs with local functions and imports
Added only a few testcases in compiler:error_SUITE and guard_SUITE The new behaviour of warnings and errors when overriding autoimported BIF's: Bifs that were autoimported before R14 are dangerous because old code using them and overriding them in exports can start behaving differently. For newly added autoimports this can't happen to the new code that wants to (or dont want to) use them, why only warnings are added for the BIFs autoimported after the compilator change. Errors are issued only for code that could have worked in one way in R13 and now will behave in a different way. If overriding autoimport with local function: - if explicit -compile directive supresses autoimport -> no message else - if called from inside module - if pre R14 autoimported bif -> error else -> warning else -> no message If overriding autoimport with import directive - if explicit -compile directive supresses autoimport -> no message else (regardless of actual usage) - if pre R14 autoimported bif -> error else -> warning Calls of local functions or imports overriding autoimported functions (either post R14 or by using explicit -compile supressions of autoimport) always goes to the local function or the imported. The compileation errors are added to not let code like this silently and disastrously change its semantic (probably to an infinite loop) between R13 and R14: ---------- -module(m). -export([length/1]). length(X) -> ... Y = length(Z), .... ---------- The user has to select if he/she wants to call length in 'erlang' explicitly or if the overriding semantics is desired, in which case the -compile directive has to be used. -compile({no_auto_import,[F/A]}). Is added to allow to override the autoimports so that code gets unanbiguous. The directive will remove an autoimport even if there is no local function or import overriding, because any other behaviour would be inconsistent and confusing. record_info and module_info can never be overridden.
Diffstat (limited to 'plt')
0 files changed, 0 insertions, 0 deletions