aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/erl_lint_SUITE.erl
AgeCommit message (Collapse)Author
2013-09-06Merge branch 'maint'Fredrik Gustafsson
Conflicts: bootstrap/lib/stdlib/ebin/erl_lint.beam
2013-08-27Fix variable usage tracking in some record errorsAnthony Ramine
When reporting a field redefinition in a record, erl_lint can forget about some old unused variables. f() -> X = 1, #r{a=foo,a=bar,a=qux}.
2013-08-27Fix unsafe variable tracking in try expressionsAnthony Ramine
Variables used in the body of a try expression were marked as unsafe *and* used, which makes no sense as an unsafe variable can't be used. Function vtsubtract/2 is used to forget usage of such unsafe variables. Reported-by: Paul Davis
2013-08-27Fix variable usage tracking in erl_lintAnthony Ramine
When analyzing complex expressions (i.e. comprehensions, cases, tries, ifs and receives), erl_lint does not forget about old unused variables when returning the updated variable table. This causes a bug where old unused variables are not recorded as such: t(X, Y) -> #r{a=[ K || K <- Y ],b=[ K || K <- Y ]}. As erl_lint uses vtmerge_pat/2 to merge the results of the analysis of the two list comprehensions, X is marked as used and the warning is not emitted. The function vtmerge_pat/2 is used instead of the similar vtmerge/2 which does not mark multiple occurrences of a variable as usage to handle cases like the following one: t(X, Y) -> #r{a=A=X,b=A=Y}. Other simpler expressions like conses, tuples and external fun references do not correctly follow this behaviour, e.g. A is not marked as used in the following code: t(X, Y) -> {A=X,A=Y}. This commit fixes both issues and makes erl_lint not return old unused variables in updated tables and makes all compound expressions use vtmerge_pat/2. Reported-by: Anders Ramsell
2013-08-21Merge branch 'maint'Hans Bolinder
* maint: Fix a bug in the linter regarding the 'fun M:F/A' construct
2013-08-20Fix a bug in the linter regarding the 'fun M:F/A' constructHans Bolinder
If the fun M:F/A construct was used erroneously the linter could crash. Thanks to Mikhail Sobolev for reporting the bug.
2013-06-05Forbid unsized fields in patterns of binary generatorsAnthony Ramine
It makes no sense to be able to do `<<...,Rest/binary>> <= ...` in a comprehension. The related Dialyzer test is removed.
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-01-31Test calling deprecated or removed functionsBjörn Gustavsson
2013-01-31Test deprecating list_to_atom/1 to cover more codeBjörn Gustavsson
2013-01-31Cover binary syntax errors and warningsBjörn Gustavsson
2013-01-31Test a few more kinds of illegal guard expressionsBjörn Gustavsson
2013-01-31Provoke basic semantic errors to improve test coverageBjörn Gustavsson
2013-01-18Remove support for parameterized modulesBjörn Gustavsson
2013-01-09erl_lint_SUITE: Eliminate use of packagesBjörn Gustavsson
2012-09-26Warn for underspecified opaque typesHans Bolinder
2012-09-26Warn for opaque types that are not exportedHans Bolinder
2012-08-17Remove support for tuple funsBjörn Gustavsson
Tuple funs were deprecated in R15B (in commit a4029940e309518f5500).
2012-08-15erl_lint: Add a deprecated warning for literal tuple funsBjörn Gustavsson
The run-time warning for use of tuple funs will not catch the use of literal tuple funs, such as: if {erlang,'+'}(3,X) =:= 0 -> true; true -> false end. Therefore, add a compile-time warning to give users some warning before they stop working in R16.
2012-03-30Update copyright yearsBjörn-Egil Dahlberg
2012-01-26erl_lint: Disallow call to is_record/3 if there is a local is_record/3Björn Gustavsson
Attempting to call is_record/3 (without an erlang: prefix) from a guard if there was a local function named is_record/3 would cause a compiler crash. For consistency with other guard tests, disallow the call. is_record/2 in a guard will still be allowed (and work correctly) even if there is a local is_record/2. It could be argued that is_record/2 should be handled in the same way as is_record/3, but changing that now could break working code.
2012-01-17erl_lint: Consistently reject local calls from guardsBjörn Gustavsson
If a guard test (such as is_list/1) has a local definition in a module (or is imported), erl_lint will reject a call to it from a guard if the call is not at the top-level: foo(L) when is_list(L) =:= true -> %% Will be rejected. ok. is_list(_) -> ok. But if the call is at the top-level, it will be accepted (and cause a crash in a later compiler pass): foo(L) when is_list(L) -> %% Will be accepted by erl_lint ok. is_list(_) -> ok. This inconsistency was an oversight introduced when it became possible to override BIFs with local definitions.
2011-08-31Improve and correct types and specifications in Kernel and STDLIBHans Bolinder
Running Dialyzer on the test suites revealed a few type errors.
2011-02-17Rename Suite Callback to Common Test HookLukas Larsson
2011-02-17Fix formatting for stdlibLukas Larsson
2011-02-17Add init_per_suite and end_per_suiteLukas Larsson
2011-02-17Add ts_install_scb to suite/0Lukas Larsson
2011-02-17Update stdlib tests to conform with common_test standardLukas Larsson
2011-02-17Update all fin_per_testcase to end_per_testcase.Lukas Larsson
2011-01-18Refuse to compile functions with too many argumentsBjörn Gustavsson
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-02Improve coverage of erl_int in testcasesPatrik 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-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-09erl_lint_SUITE: adjust failing test caseBjörn Gustavsson
Errors are now reported slightly differently, so we'll need to adjust the test case.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP