Age | Commit message (Collapse) | Author |
|
* maint:
dialyzer: Improve check of unknown types
|
|
The implementation of OTP-14218 (commit 6d3b38a) has a weakness: only
a very limited part of the type form is checked. This is now fixed:
types not used by specs are checked equally well as types used by
specs.
The new function erl_types:t_from_form_check_remote() checks usage of
remote types. It does not expand used local types, and has (almost) no
limits on depth and size.
|
|
This commit removes the old code branches that attempted
to translate Erlang Abstract Format to Core and relies
exclusively on the new debug_info chunk.
This is a follow up to #1367.
|
|
Instead of two records, #plt{} with dict:s and #mini_plt{} with ETS
tables, one record is used for representing PLT:s in RAM.
The #mini_plt{} is the one now used throughout analyses, but it is
called #plt{}.
When writing the PLT to file, another record is used, #file_plt{} (as
before). When creating #file_plt{}, the #plt{} is deleted (it cannot
be used for further analyses).
|
|
|
|
|
|
|
|
Due to a bug in Dialyzer, unknown types have been introduced.
|
|
The new Dbgi chunk returns data in the following format:
{debug_info_v1, Backend, Data}
This allows compilers to store the debug info in different
formats. In order to retrieve a particular format, for
instance, Erlang Abstract Format, one may invoke:
Backend:debug_info(erlang_v1, Module, Data, Opts)
Besides introducing the chunk above, this commit also:
* Changes beam_lib:chunk(Beam, [:abstract_code]) to
read from the new Dbgi chunk while keeping backwards
compatibility with old .beams
* Adds the {debug_info, {Backend, Data}} option to
compile:file/2 and friends that are stored in the
Dbgi chunk. This allows the debug info encryption
mechanism to work across compilers
* Improves dialyzer to work directly on Core Erlang,
allowing languages that do not have the Erlang
Abstract Format to be dialyzer as long as they emit
the new chunk and their backend implementation is
available
Backwards compatibility is kept across the board except
for those calling beam_lib:chunk(Beam, ["Abst"]), as the
old chunk is no longer available. Note however the "Abst"
chunk has always been optional.
Future OTP versions may remove parsing the "Abst" chunk
altogether from beam_lib once Erlang 19 and earlier is no
longer supported.
The current Dialyzer implementation still supports earlier
.beam files and such may also be removed in future versions.
|
|
The table used during translation of forms to types used to be a
dictionary of the type info (-type(), -opaque(), and -record()) for
all modules. Now it is reduced to the modules that are needed to
handle references to types in other modules.
The PLT:s type info is still kept on the heap.
|
|
* maint:
dialyzer: Compact 'file' annotations in Core code
dialyzer: Try to reduce memory usage
dialyzer: Use less memory when translating contracts
dialyzer: Use maps instaed of dict
dialyzer: Use maps instead of dict for module contracts map
dialyzer: Compress a few more ETS tables
dialyzer: Optimize memory consumption
dialyzer: Reduce memory consumption during 'remote' phase
dialyzer: Update code for finding parallelism
compiler: Do not spawn process when dialyzing
dialyzer: Reduce ETS usage during the typesig phase
dialyzer: Optimize graph condensation
dialyzer: Do not send full PLTs as messages
|
|
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.
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
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.
|
|
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.)
|
|
|
|
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.
|
|
OTP-12845
* bruce/change-license:
fix errors caused by changed line numbers
Change license text to APLv2
|
|
|
|
|
|
Opaque types need to be expanded before record field types, otherwise
any() could be used for opaque types.
|
|
Remove what it seems redundant checks.
|
|
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.
|
|
|
|
|
|
In particular fix handling of records.
|
|
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.
|
|
The compiler option 'asm' has been replaced by 'from_asm' in
Erlang/OTP 18.0.
|
|
* maint:
dialyzer: do a minor re-factoring
dialyzer: Ignore ERL_COMPILER_OPTIONS when compiling
dialyzer: fix bug concerning compiler option 'warnings_as_errors'
|
|
A minor re-factoring and generalization.
|
|
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.
|
|
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.
|
|
|
|
* fishcakez/dialyzer_beam_opts:
Use compile options when dialyzing beam files
|
|
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
|
|
* maint:
[dialyzer] Correct a doc bug introduced in 0b041238
[dialyzer] Use the option 'dialyzer' to control the compiler
[dialyzer] Fix handling of literal records
|
|
|
|
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.
|
|
|
|
* fenollp/otp-edoc-usage-fixes:
Fix edoc usage errors
OTP-11702
|
|
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.
|