aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/erl_lint_SUITE.erl
AgeCommit message (Collapse)Author
2014-05-05Remove pre-defined types dict(), digraph(), &cHans Bolinder
The pre-defined types array(), dict(), digraph(), gb_set(), gb_tree(), queue(), set(), and tid() have been removed.
2014-04-29[stdlib] Simplify some linter warnings about specsHans Bolinder
Use F/A rather than M:F/A for local functions.
2014-04-29Disallow '_' as type variableHans Bolinder
"... when _ :: ..." used to compile, but Dialyzer crashed.
2014-04-29Fix a -callback attribute bugHans Bolinder
sys_pre_expand used to crash. There is no known reason to allow -callback attributes with explicit module.
2014-04-29Allow more type namesHans Bolinder
product/_, union/_, range/2 as well as tuple/N (N > 0), map/N (N > 0), atom/1, integer/1, binary/2, record/_, and 'fun'/_ can now be used as type names.
2014-04-28Introduce the attribute -optional_callbacks in the context of behavioursHans Bolinder
2014-04-16stdlib: Fix error message when exporting (redefined) map() typeHans Bolinder
When redefining and exporting the type map() erl_lint erroneously emitted an error. This bug has been fixed.
2014-04-03stdlib: Deny map keys defined as #{ .. := .. } in patternsBjörn-Egil Dahlberg
2014-03-26Merge branch 'bjorn/stdlib/otp_internal'Björn Gustavsson
* bjorn/stdlib/otp_internal: otp_internal: No longer warn for funtions removed in R13B otp_internal: Postpone removals from R17 to OTP 18
2014-03-25otp_internal: No longer warn for funtions removed in R13BBjörn Gustavsson
The grace period is over.
2014-03-24stdlib: warn if the type map() is redefinedHans Bolinder
2014-03-17stdlib: Test Map key lintingBjörn-Egil Dahlberg
This will change in future release.
2014-03-17stdlib: Move map type to proper definitionBjörn-Egil Dahlberg
2014-03-07Emit errors when redefining arity(), bitstring(), iodata(), or boolean()Hans Bolinder
erl_lint has since R13B emitted warnings whenever any of the types arity(), bitstring(), iodata(), or boolean() were re-defined. Now errors are emitted instead.
2014-03-07stdlib: Emit linter warnings for redefined built-in typesHans Bolinder
Since Erlang/OTP R16B the linter has not emitted warnings when built-in types were re-defined. This bug has been fixed. Thanks to Roberto Aloi for reporting the bug.
2014-03-06Merge branch 'nox/maps-improve-erl_lint'Björn-Egil Dahlberg
* nox/maps-improve-erl_lint: Improve linting of map expressions
2014-03-05Merge branch 'nox/compiler/lint-shortcircuit-ops'Björn Gustavsson
* nox/compiler/lint-shortcircuit-ops: Properly lint shortcircuiting operators
2014-03-04Introduce compiler option 'nowarn_deprecated_type'Hans Bolinder
The deprecation of the built-in types dict/0 and so on had as side-effect that it was impossible to switch to dict:dict/2 and so on without getting warnings either in the the previous release (R16B) or the current one (17.0). By including the attribute -compile(nowarn_deprecated_type). in an Erlang source file warnings about deprecated types can be avoided in 17.0. The option can also be given as a compiler flag: erlc +nowarn_deprecated_type file.erl
2014-03-04Improve message about deprecated built-in typesHans Bolinder
2014-03-04Improve linting of map expressionsAnthony Ramine
Map fields are put in their own function instead of being clauses of expr/3. Also, invalid map construction expressions now emit one error per ':=' field, at the location of said field instead of one for the whole expression, furthermore, such warnings do not stop linting of their key and value expressions anymore. Ill-formed maps constructions are now also properly detected in guard expressions.
2014-03-01Properly lint shortcircuiting operatorsAnthony Ramine
Shortcircuiting operators are not real functions and can't be used as such with erlang:'andalso'(...) and erlang:'orelse'(...). Reported-by: Ulf Norell
2014-02-23Deprecate pre-defined built-in typesHans Bolinder
The types array(), dict(), digraph(), gb_set(), gb_tree(), queue(), set(), and tid() have been deprecated. They will be removed in OTP 18.0. Instead the types array:array(), dict:dict(), digraph:graph(), gb_set:set(), gb_tree:tree(), queue:queue(), sets:set(), and ets:tid() can be used. (Note: it has always been necessary to use ets:tid().) It is allowed in OTP 17.0 to locally re-define the types array(), dict(), and so on. New types array:array/1, dict:dict/2, gb_sets:set/1, gb_trees:tree/2, queue:queue/1, and sets:set/1 have been added.
2014-02-10Merge branch 'josevalim/suppress-all-auto-imports'Henrik Nord
* josevalim/suppress-all-auto-imports: Allow all auto imports to be suppressed at once OTP-11682
2014-01-23Properly handle export_all when looking for undefined callbacksAnthony Ramine
Reported-by: Michele Miron
2013-12-12Test named funsAnthony Ramine
2013-10-18Allow all auto imports to be suppressed at onceJosé Valim
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.
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