aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_utils.erl
AgeCommit message (Collapse)Author
2017-03-10Update copyright yearRickard Green
2017-01-11dialyzer: Try to reduce memory usageHans Bolinder
The translation from forms to types is done in a separate process in an attempt to reduce peak memory usage. Expect further optimizations as it is probably not feasible in the long run to keep all type information on the heap.
2017-01-11dialyzer: Use maps instaed of dictHans Bolinder
2017-01-11dialyzer: Use maps instead of dict for module contracts mapHans Bolinder
2017-01-11dialyzer: Reduce memory consumption during 'remote' phaseHans Bolinder
The cache used for speeding up the translation from forms to types is no longer global, but reset per module. The peak memory consumption is reduced, and the added time seems to be small.
2017-01-11dialyzer: Update code for finding parallelismHans Bolinder
Using erlang:system_info(schedulers_online) for determining parallelism is recommended by OTP experts. It takes care of "+S 4:1" and simultaneous loading of HiPE code.
2016-10-21dialyzer: Fix error handling of bad -dialyzer() attributesHans Bolinder
If a dialyzer module attribute references an undefined (local) function an error tuple is thrown but no caught. This leads to a 'nocatch' error and not the intended "clean" error.
2016-06-09dialyzer: Use a cache when translating forms to typesHans Bolinder
2016-06-09dialyzer: Correct typesHans Bolinder
2016-04-28dialyzer: Fix another pattern literal bugMagnus Lång
dialyzer_typesig:traverse/3 would perform an unsafe optimisation when given a cons pattern that contained a map and could be folded into a literal with cerl:fold_literal/1. In this case, when traversing the map a type variable would be generated, but this variable would be dropped by the erl_types:t_cons/2 constructor by in turn calling t_sup(), producing the overapproximation any(). However, in this particular case, dialyzer_typesig:traverse/3 is not allowed to overapproximate, since its result is used in an EQ-constraint. Although erl_types:t_tuple/1 does not overapproximate like t_cons/2, which makes the bug unlikely to affect tuples too, the fix was nevertheless applied defensively to the case of tuples as well. Also, fix a bug where dialyzer_utils:refold_pattern/1 would generate syntax nodes with two {label, _} attributes.
2016-04-28dialyzer: Improve map pattern typesettingMagnus Lång
2016-04-28dialyzer: Unfold cerl patterns containing mapsMagnus Lång
Dialyzer relies heavily on the assumption that the type of a literal that is used as a pattern is the type of any value that can match that pattern. For maps, that is not true, and it was causing bad analysis results. A new help function dialyzer_utils:refold_pattern/1 identifies maps in literal patterns, and unfolds and labels them, allowing them to be properly analysed.
2016-01-26Clarify computation of exported types in DialyzerLuca Favatella
Superfluous usage of insert_temp_exported_types had been in since 6452b57. (Change in commit 8a3ea1f module dialyzer_analysis_callgraph is a correct simplification and is not relevant.)
2016-01-20dialyzer: Improve a typeHans Bolinder
2015-08-25dialyzer: Generalize an argument of erl_types:t_from_form()Hans Bolinder
Add more information about the caller of t_from_form(). Instead of just the module, also provide name of the type, spec, or record where the type form resides.
2015-06-22Merge branch 'bruce/change-license'Bruce Yinhe
OTP-12845 * bruce/change-license: fix errors caused by changed line numbers Change license text to APLv2
2015-06-22dialyzer: Correction of last commitHans Bolinder
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-18dialyzer: Expand opaque types before other typesHans Bolinder
Opaque types need to be expanded before record field types, otherwise any() could be used for opaque types.
2015-06-15dialyzer: Simplify some codeHans Bolinder
Remove what it seems redundant checks.
2015-06-15dialyzer: Fix a bug in the expansion of formsHans Bolinder
The check that a modified type of a field is a subtype of the declared type has been moved outside of the expansion of forms to avoid loops.
2015-04-30dialyzer: Use module erl_annoHans Bolinder
2015-03-10[dialyzer] Correct handling of limited opaque typesHans Bolinder
2015-03-10[dialyzer] Fix the conversion of forms to typesHans Bolinder
In particular fix handling of records.
2015-01-14dialyzer: Introduce module local suppression of warningsHans Bolinder
The -dialyzer() attribute can be used for suppressing warnings in a module by specifying functions or warning options. It can also be used for requesting warnings in a module.
2014-10-21dialyzer: remove recognition of the compiler option 'asm'Hans Bolinder
The compiler option 'asm' has been replaced by 'from_asm' in Erlang/OTP 18.0.
2014-10-10Merge branch 'maint'Hans Bolinder
* maint: dialyzer: do a minor re-factoring dialyzer: Ignore ERL_COMPILER_OPTIONS when compiling dialyzer: fix bug concerning compiler option 'warnings_as_errors'
2014-10-08dialyzer: do a minor re-factoringHans Bolinder
A minor re-factoring and generalization.
2014-10-08dialyzer: Ignore ERL_COMPILER_OPTIONS when compilingHans Bolinder
If, for instance, 'warn_unused_import' is present in ERL_COMPILER_OPTIONS then many files in Erlang/OTP (Kernel, STDLIB, ...) cannot be analyzed by Dialyzer since the option is not present when compiling Erlang/OTP, but 'warnings_as_errors' is. The case that ERL_COMPILER_OPTIONS contains 'warnings_as_errors' can only be handled by ignoring ERL_COMPILER_OPTIONS.
2014-10-08dialyzer: fix bug concerning compiler option 'warnings_as_errors'Hans Bolinder
A typical scenario: the type digraph() is used in R16 (compilation with the option 'warnings_as_errors' results in no warning); then the module is analyzed by a 17 Dialyzer where digraph() is obsolete, and since the warning is turned into an error Dialyzer fails to load the module. Thanks to Michael Truog.
2014-09-09Merge branch 'maint'Henrik Nord
2014-09-09Merge branch 'fishcakez/dialyzer_beam_opts' into maintHenrik Nord
* fishcakez/dialyzer_beam_opts: Use compile options when dialyzing beam files
2014-07-16Use compile options when dialyzing beam filesJames Fish
Fetch the compile options from beam files, and use them when creating core from the abstract code. Previously the options were ignored. Test by Henrik Nordh
2014-06-17Merge branch 'maint'Hans Bolinder
* maint: [dialyzer] Correct a doc bug introduced in 0b041238 [dialyzer] Use the option 'dialyzer' to control the compiler [dialyzer] Fix handling of literal records
2014-06-17[dialyzer] Use the option 'dialyzer' to control the compilerHans Bolinder
2014-06-17[dialyzer] Fix handling of literal recordsHans Bolinder
This ticket is about records in Erlang code, and when to check the fields against the (optional) types given when defining records. Dialyzer operates on the Erlang Core format, where there are no trace of records. The fix implemented is a Real Hack: Given the new option 'dialyzer' erl_expand_records marks the line number of records in a way that is undone by v3_core, which in turn inserts annotations that can be recognized by Dialyzer.
2014-04-28Introduce the attribute -optional_callbacks in the context of behavioursHans 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-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-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.
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-15Support for types with the same name and different arityStavros Aronis
2012-08-31Update copyright yearsBjörn-Egil Dahlberg
2012-05-21Regulate all kinds of running workers up to the number of schedulersStavros Aronis
2011-11-18Collect callback definitions during compilationStavros Aronis
2011-03-11Refactoring so that a flat string() is returnedKostis Sagonas
2010-09-24Fix two errors in dialyzerKostis Sagonas
Changes which fix some problems reported by dialyzer users: 1. The handling of nested opaque types 2. The handling of remote types in record expressions used as types While at it, updated dialyzer's RELEASE_NOTES to reflect these fixes and did some cleanups to dialyzer_utils.erl so that it gets in sync with dialyzer's main development branch.
2010-06-08Various changes to dialyzer-related files for R14.Kostis Sagonas
Bumped version number and wrote RELEASE_NOTES. Included all changes described in release notes. Some spec-related changes to some files in lib/hipe/cerl.
2010-06-07Fix confusing dialyzer warnings for is_record/2 with illegal recordsBjörn Gustavsson
In commit 1858cb81391d2bce29b4b7620574ca60128cebf7, erl_expand_records started to optimize is_record/2 in guards by replacing it with pattern matching (if possible). Unfortunately, dialyzer will no longer see the code before the optimization, so any warnings produced in code such as: case ExprNotProducingRecord#rec{} of X when is_record(X, rec, N) -> ... will refer to the optimized code and not the source code, which is confusing for the user. Introduce the no_is_record_optimization option for turning off the optimization and use it in dialyzer. Reported-by: Kostis Sagonas
2010-06-03Support -export_type() in dialyzer and erl_typesKostis Sagonas