aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer
AgeCommit message (Collapse)Author
2014-03-28Dialyzer now plays nicely with funs that come as "external" argumentsStavros Aronis
Two steps are needed to make this work: 1) Avoid generating the additional "apply_constraint" in dialyzer_typesig by reporting every function argument as a potential external function (patch on dialyzer_dep). This will produce correct success typings for all functions in the test case, but dataflow would miss the key warnings that help identify the bugs. 2) Patch dialyzer_dataflow so that it uses the "handle just external" path as a fallback whenever there are any external calls. As a result, if we have info about some paths, then: a) use the old "handle known apply" code to mark these functions as used and b) ignore the generalized result and use the one found by typesig for the return value of the apply itself.
2014-03-26Merge branch 'aronisstav/hipe/opaque_fix'Hans Bolinder
* aronisstav/hipe/opaque_fix: Don't 'opaque-decorate' a success typing using an incompatible spec
2014-03-24Don't 'opaque-decorate' a success typing using an incompatible specStavros Aronis
Without this patch Dialyzer crashes when analyzing the supplemented test case.
2014-03-24Correct some type declarationsKostis Sagonas
The types of some record fields were wrong. This file uses some module local format of race warnings and when the analysis is done transforms this format into the format of general dialyzer warnings. This change fixes the type declaration of the race_warning field of the #races{} record which was wrong. In addition, declared the type of the state field in some other record that, long ago, could not be declared since mutually recursive types were not supported by Dialyzer's analysis.
2014-03-24Use the ordsets:ordset(T) type instead of defining a local oneKostis Sagonas
2014-03-24stdlib: warn if the type map() is redefinedHans Bolinder
2014-03-21dialyzer: generalize guard constraints in a new wayHans Bolinder
Guard constraints used to be limited to a certain depth, which handled mutually depending constraints safely, but also sometimes introduced unnecessary generalizations. This patch puts no explicit limit upon guard constraints (other than those that already exist in erl_types), but breaks cycles by replacing variables with the any() type. In some cases the old method resulted in more warnings, but since the limit was quite arbitrary and mutually depending guard constraints are (very) rare, the new method should been seen as an improvement since it handles cases that used to make Dialyzer loop or miss warnings.
2014-03-20Introduce runtime_dependencies in .app filesRickard Green
Most dependencies introduced are exactly the dependencies to other applications found by xref. That is, there might be real dependencies missing. There might also be pure debug dependencies listed that probably should be removed. Each application has to be manually inspected in order to ensure that all real dependencies are listed. All dependencies introduced are to application versions used in OTP 17.0. This since the previously used version scheme wasn't designed for this, and in order to minimize the work of introducing the dependencies.
2014-03-20Introduce a new warning option, 'no_unknown'Hans Bolinder
Not (yet) documented.
2014-03-20Return warnings for unknown types and functions in Erlang ModeHans Bolinder
The warnings about unknown types and functions are now returned when calling Dialyzer from Erlang, in particular from an escript. When calling Dialyzer from the command line the warnings about unknown types and functions are output last as before; and when using the GUI the warnings are displayed in a pop-up window, as before.
2014-03-20Merge branch 'siri/master-cuddle-with-tests'Siri Hansen
* siri/master-cuddle-with-tests: Remove "coding: utf-8" from test files Change encoding for XML files to utf-8
2014-03-17dialyzer: Do not native compile modules with Maps codeBjörn-Egil Dahlberg
hipe:c/1 ignores '-compile(no_native).'
2014-03-17Remove "coding: utf-8" from test filesSiri Hansen
UTF-8 is now the default encoding and should no longer be specified. These have probably been merged from maint earlier and the coding statement was missed. lib/dialyzer/test/opaque_SUITE_data/src/modules/opaque_erl_scan.erl lib/diameter/test/diameter_codec_test.erl lib/ssh/test/ssh_unicode_SUITE.erl
2014-03-04Improve message about deprecated built-in typesHans Bolinder
2014-02-24Merge branch 'fenollp/otp-edoc-usage-fixes'Henrik Nord
* fenollp/otp-edoc-usage-fixes: Fix edoc usage errors OTP-11702
2014-02-24Merge branch 'hb/dialyzer/fix_on_load/OTP-11743'Hans Bolinder
* hb/dialyzer/fix_on_load/OTP-11743: FIx handling of 'on_load' attribute
2014-02-24Merge branch 'hb/dialyzer/deprecate_types/OTP-10342'Hans Bolinder
* hb/dialyzer/deprecate_types/OTP-10342: Deprecate pre-defined built-in types
2014-02-24Merge branch 'schlagert/fix_basic_appups'Siri Hansen
* schlagert/fix_basic_appups: Dynamically configure typer_SUITE according to environment Disable hipe_SUITE when environment doesn't support it Make hipe non-upgradable by setting appup file empty Fix missing module on hipe app file template Add test suites performing app and appup file checks Introduce appup test utility Fix library application appup files Fix non-library appup files according to issue #240 OTP-11744
2014-02-24Add test suites performing app and appup file checksTobias Schlager
Add the mentioned test suites for *all* library and touched non-library applications.
2014-02-24FIx handling of 'on_load' attributeHans Bolinder
[pull request from Kostis Sagonas] The handling of functions appearing in an 'on_load' attribute was wrong. Instead of considering the functions specified in these attributes as escaping from the module and performing a full analysis starting from them, the code just bypassed this analysis and only suppressed unused warning messages for these functions. This worked for most of the cases but resulted in functions (directly or indirectly) called by 'on_load' functions being reported as not called by the module. Such a case existed in the code of the 'crypto' application. To solve these issues the initialization code for functions escaping from the module was changed and the test for the on_load functionality was appropriately extended.
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-22Introduce parameterized opaque typesHans Bolinder
Handle immediate opaque types as aliases: A declaration of dict/0 -opaque dict() :: dict(_, _). -opaque dict(Key, Value) :: ... is handled as an alias, that is, when using dict() it is immediately replaced by dict(_, _). This is a means to avoid having to handle equivalent opaque types later. To be changed if it doesn't work well.
2014-02-18Fix library application appup filesTobias Schlager
As discussed in issue #240 *all* OTP library applications use the '.*' wildcard as up and down version. This makes library applications always up- and downgradeable. Using the wildcard version obsoletes all maintenance tasks regarding library applications' appup files. Additionally, it prevents upgrade problems caused by automatically included application dependencies when using reltool to create releases. Missing copyright headers are now consistently present.
2014-02-17Merge branch 'bjorn/lc-warnings/OTP-11626'Björn Gustavsson
* bjorn/lc-warnings/OTP-11626: dialyzer: Silence useless warnings about list comprehensions
2014-02-14Merge branch 'vinoski/dialyzer-doc-fix'Henrik Nord
* vinoski/dialyzer-doc-fix: fix -Wno_behaviours doc error in dialyzer man page OTP-11706
2014-02-14Fix edoc usage errorsPierre Fenoll
Errors discovered using `erldocs`: Superfluous @hidden tag would exit edoc application; 'Multiple @spec tag': appended a @clear tag after macro condition; '@spec arity does not match': added missing argument.
2014-02-07Merge branch 'kostis/dialyzer-r17c0-fixes'Henrik Nord
* kostis/dialyzer-r17c0-fixes: Shut off a dialyzer unmatched return warning Add a spec for a function that does not return
2014-02-06Add app-test and correct dialyzer.app.srcHans Bolinder
2014-02-05dialyzer: Silence useless warnings about list comprehensionsBjörn Gustavsson
Dialyzer will warn if the value of list comprehension is ignored by putting it in a sequence like this: [SomeSideEffect(E) || E <- Es], ok To avoid a warning, you'll have to write: _ = [SomeSideEffect(E) || E <- Es], ok Most of the time, this warning is merely annoying because it does not point out any real errors. Kostis Sagonas suggested that by suppressing the warning for list comprehension that return a list of a simple type (e.g. ['ok']), there would be no warning for code such as: [io:format("~p\n", [E]) || E <- Es], ok but there would be still be a warning for: [file:close(Fd) || Fd <- Fds], ok because an error condition is ignored.
2014-01-31Shut off a dialyzer unmatched return warningKostis Sagonas
Dialyzer does not like list comprehensions for which the result is not assigned to some variable (maybe anonymous). In this particular case, the comprehension, containing only a filter but no generator, was used to save some lines, but IMO this type of code, while "cute", is not so easy to comprehend.
2014-01-31Add a spec for a function that does not returnKostis Sagonas
2014-01-29dialyzer: Add maps testsBjörn-Egil Dahlberg
2014-01-29dialyzer: Remove dead codeBjörn-Egil Dahlberg
2014-01-29dialyzer: Reflect map_pair core changes in dialyzerBjörn-Egil Dahlberg
2014-01-28dialyzer,hipe,stdlib: Add Maps understanding to DialyzerBjörn-Egil Dahlberg
2014-01-28Merge branch 'hb/dialyzer/opaque_types_fixes/OTP-10397'Hans Bolinder
* hb/dialyzer/opaque_types_fixes/OTP-10397: [dialyzer] Re-work the handling of opaque types
2014-01-21[dialyzer] Re-work the handling of opaque typesHans Bolinder
It is now OK to inspect and modify the internals of opaque types within the scope of the module. The contracts are used for decorating types with opaqueness when it is harmless to do so. The opaqueness is propagated by the typesig module and also by the dataflow module. A lot of details have been fixed or updated. In particular the modules erl_types and erl_bif_types have been modified extensively. The version in vsn.mk has been updated to 2.7. The reason is a modification of #opaque{} in erl_types. Dialyzer seems to be about five percent slower than it used to be.
2014-01-14Fix an erroneous specKostis Sagonas
The branch that patched this file to handle the new "named funs" added an extra argument to the main function of the module but forgot to update its spec.
2014-01-12fix -Wno_behaviours doc error in dialyzer man pageSteve Vinoski
The description of the -Wno_behaviours in the dialyzer man page incorrectly includes a "***" footnote marker, indicating that it's an option that turns on a warning rather than turning it off. Since the option actually turns off a warning, remove the marker. This fix makes the documentation match that obtained from dialyzer --help.
2013-12-20Merge remote-tracking branch 'origin/kostis/dialyzer_hipe-remove-gs'Dan Gudmundsson
2013-12-12Test named funsAnthony Ramine
2013-12-12EEP 37: Funs with namesAnthony Ramine
This adds optional names to fun expressions. A named fun expression is parsed as a tuple `{named_fun,Loc,Name,Clauses}` in erl_parse. If a fun expression has a name, it must be present and be the same in every of its clauses. The function name shadows the environment of the expression shadowing the environment and it is shadowed by the environment of the clauses' arguments. An unused function name triggers a warning unless it is prefixed by _, just as every variable. Variable _ is allowed as a function name. It is not an error to put a named function in a record field default value. When transforming to Core Erlang, the named fun Fun is changed into the following expression: letrec 'Fun'/Arity = fun (Args) -> let <Fun> = 'Fun'/Arity in Case in 'Fun'/Arity where Args is the list of arguments of 'Fun'/Arity and Case the Core Erlang expression corresponding to the clauses of Fun. This transformation allows us to entirely skip any k_var to k_local transformation in the fun's clauses bodies.
2013-12-12Support non top level letrecs in dialyzerJosé Valim
Dialyzer so far only supported letrecs at the top-level and comprehension-like letrecs (i.e. that were directly applied) in their body. This commit address this issue by storing in the callgraph bound letrec labels pointing to their functions. This information is then used by the dataflow to properly lookup recursive definitions.
2013-11-13Remove the --wx option and promore the --gui to use the wx-based GUIKostis Sagonas
2013-11-13Remove the GS-based GUI of DialyzerKostis Sagonas
R17 will come without support for 'gs' so the old gs-based GUI of dialyzer has been removed.
2013-10-14Merge branch 'maint'Fredrik Gustafsson
2013-10-14Merge branch 'fenollp/treewide_remove_unexpected_0xff/OTP-11323' into maintFredrik Gustafsson
* fenollp/treewide_remove_unexpected_0xff/OTP-11323: Remove ^L characters hidden randomly in the code. Not those used in text files as delimiters.
2013-10-14Merge branch 'maint'Fredrik Gustafsson
2013-10-14Merge branch 'kostis/dialyzer_R16B02_fixes/OTP-11374' into maintFredrik Gustafsson
* kostis/dialyzer_R16B02_fixes/OTP-11374: Fix crash when using remote types in the tail of list types Adopt a convention about unknown modules No reason for calls to unknown modules Use the modern version of is_subtype Adopt a convention about unknown modules Fix a comment Add some more comments about what the test does
2013-10-10Merge branch 'maint'Fredrik Gustafsson