aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/erl_lint.erl
AgeCommit message (Collapse)Author
2011-01-18Refuse to compile functions with too many argumentsBjörn Gustavsson
2010-10-06Avoid errors for a badly formed export_type declarationsKostis Sagonas
In the following program, erl_lint crashed with an erl_lint internal error. With this patch it does not, but prints "bad export_type declaration" errors instead. -module(baz). -export([test/0]). -export_type(t/0). -export_type([3.14]). -type t() :: any(). test() -> 42.
2010-06-09Merge branch 'pan/otp_8683_compiler_warnings' into HEADErlang/OTP
* pan/otp_8683_compiler_warnings: Remove (harmless) warning regarding auto-imported BIF max/2 Update primary bootstrap Correct warnings and errors for auto-imported bif clashes Conflicts: bootstrap/lib/stdlib/ebin/erl_lint.beam
2010-06-09Correct warnings and errors for auto-imported bif clashesPatrik Nyblom
warn_unused_import works correctly (does not give warnings when overridden). Local call in guard gives its own error pointing out the local/imported function. Use of the phrase "overridden auto-imported bif" instead of "redefined auto-imported bif" in textual error messages.
2010-06-07Remove tid() from the predefined builtin types.Kostis Sagonas
Change erl_lint not to recognize this type as builtin and add a new erl_lint.beam version in bootstrap. Add an -opaque type declaration for this type in ets.erl and also declare this as an exported type. Use this type in file debugger/src/dbg_iload.erl in a spec. While at it, also clean up this later file a bit.
2010-06-03erl_lint: Issue warnings for undefined exported typesKostis Sagonas
2010-06-03Add infrastructure for the -export_type() attributeKostis Sagonas
erl_lint has been updated so that it takes the new -export_type() attribute into account. This means: - do not complain about types which are defined but nowhere used in the module but exported to other modules - check that all types which are exported are indeed defined in the module - warn when there are multiple occurrences of exported types. In doing this change, I've also taken the liberty to introduce many types and specs for functions of this module and to do small cleanups here and there.
2010-06-02Remove outcommented code from erl_lintPatrik Nyblom
2010-06-02Change warning to error for nowarn_bif_clash compiler directivePatrik Nyblom
2010-06-02Return nowarn_bif_clash functionality but with warningPatrik Nyblom
Wrote and changed some tests in stdlib:erl_lint_SUITE nowarn_bif_clash is obsoleted but will remove warnings and errors about bif clashes. The recommended way is to use no_auto_import directives instead. Hopefully erlang.erl is the only user in the world of nowarn_bif_clash.
2010-06-02Teach erl_lint to better override BIFs with local functions and importsPatrik Nyblom
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.
2010-06-02Teach compiler to override autoimport with importPatrik Nyblom
2010-06-02First prototype for local functions overriding autoimportedPatrik Nyblom
Import directives still not sorted out!
2010-06-02OTP-8664 Erlang parser augmented with operators for integer typesHans Bolinder
Expressions evaluating to integers can now be used in types and function specifications where hitherto only integers were allowed ("Erlang_Integer").
2010-03-16Remove stray code supporting 'cond'Björn Gustavsson
'cond' is an experimental feature that was never completed.
2010-03-10Fix a crash when using an undefined record name as a typeKostis Sagonas
2010-02-10Merge branch 'ks/erl_lint' into ccase/r13b04_devErlang/OTP
* ks/erl_lint: erl_lint_SUITE: adjust failing test case Allow recursive types and check for undefined types OTP-8421: ks/erl_lint
2010-02-09Allow recursive types and check for undefined typesKostis Sagonas
Contains four kinds of changes: * Allows recursive types and type definitions to be in any order. * Because the checking is not performed from top to bottom, there is a separate pass which checks for undefined module-local types. * Behaviour callbacks which allow specs in them. * Clean up the code as suggested by tidier.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP