aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src
AgeCommit message (Collapse)Author
2019-02-06dialyzer: Fix a bug regarding contractsHans Bolinder
See also https://bugs.erlang.org/browse/ERL-845. Fix a bug that caused Dialyzer to crash when analyzing a contract with a module name differing from the analyzed module's name. The bug was introduced in Erlang/OTP 18.
2018-05-25dialyzer: Refine the test for overspecified functionsHans Bolinder
The -Woverspecs (-Wspecdiffs) option generates warnings in a few more cases. The refinement is analogous to the test that -Wunderspecs already does: it checks if the contract has nothing in common with some element (see erl_types:t_elements/1) of the success typing.
2018-05-13dialyzer: Do not emit warnings for unreachable funsHans Bolinder
Warnings are not generated for funs residing in dead code. In particular, warnings like "The created fun has no local return" are no longer generated for funs declared in clauses or functions that cannot be run.
2018-03-13Merge branch 'hasse/dialyzer/extra-range/OTP-14970'Hans Bolinder
* hasse/dialyzer/extra-range/OTP-14970: ssl: Correct some specs os_mon: Correct a spec Fix broken spec in beam_asm Dialyzer should not throw away spec information because of overspec
2018-02-26Merge pull request #1719 from josevalim/jv-faster-dialyzer-md5Hans Bolinder
dialyzer: Compute MD5s using the .beam file (OTP-14937)
2018-02-23Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Correct a parameterized opaque types bug
2018-02-21Compute MD5s in dialyzer using the .beam fileJosé Valim
The previous mechanism was based on the core file which meant that for every module in the PLT, we had to fetch its .beam file, retrieve Erlang AST, compile that down to core, serialize it into a binary and then get its MD5. In a project with stdlib, kernel, elixir and a small application in the PLT, relying only on the .beam sped up --check_plt from 10s to 0.8s.
2018-02-21dialyzer: Correct a parameterized opaque types bugHans Bolinder
See also https://bugs.erlang.org/browse/ERL-565. To avoid loops, erl_types:t_is_subtype checks for equality using unopaqued types, but in (at least) one case something is lost: This fix makes sure that when forwarding arguments in dataflow, types with different parameters but equal when unopaqued are considered different. For example, dict:dict(0, {}) and dict:dict(0, []) are equal when unopaqued (due to how dict(_, _) is declared in module dict), but should be considered different when forwarding args.
2018-02-20Dialyzer should not throw away spec information because of overspecRichard Carlsson
2018-02-15Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Fix a crash
2018-02-14dialyzer: Fix a crashHans Bolinder
2018-02-07Merge branch 'hasse/no_get_stacktrace/OTP-14861'Hans Bolinder
* hasse/no_get_stacktrace/OTP-14861: erts: Update abstract format doc with stacktrace variable wx: Do not call erlang:get_stacktrace() tools: Do not call erlang:get_stacktrace() stdlib: Do not call erlang:get_stacktrace() sasl: Do not call erlang:get_stacktrace() runtime_tools: Do not call erlang:get_stacktrace() reltool: Do not call erlang:get_stacktrace() parsetools: Do not call erlang:get_stacktrace() observer: Do not call erlang:get_stacktrace() mnesia: Do not call erlang:get_stacktrace() (cont) mnesia: Do not call erlang:get_stacktrace() kernel: Do not call erlang:get_stacktrace() inets: Do not call erlang:get_stacktrace() eunit: Do not call erlang:get_stacktrace() et: Do not call erlang:get_stacktrace() dialyzer: Do not call erlang:get_stacktrace() debugger: Do not call erlang:get_stacktrace() debugger: Do not try to restore stacktrace common_test: Do not call erlang:get_stacktrace()
2018-02-06dialyzer: Assign a type to the primop build_stacktraceHans Bolinder
2018-02-05dialyzer: Do not call erlang:get_stacktrace()Hans Bolinder
2018-01-23Merge branch 'maint'Hans Bolinder
* maint: kernel: Correct contracts and a bug in group_history stdlib: Correct contracts dialyzer: Optimize handling of a lot of warnings Conflicts: lib/kernel/src/erl_boot_server.erl
2018-01-22dialyzer: Optimize handling of a lot of warningsHans Bolinder
If the number of warnings is huge the '--'/2 operator is slow.
2017-11-30Add syntax in try/catch to retrieve the stacktrace directlyBjörn Gustavsson
This commit adds a new syntax for retrieving the stacktrace without calling erlang:get_stacktrace/0. That allow us to deprecate erlang:get_stacktrace/0 and ultimately remove it. The problem with erlang:get_stacktrace/0 is that it can keep huge terms in a process for an indefinite time after an exception. The stacktrace can be huge after a 'function_clause' exception or a failed call to a BIF or operator, because the arguments for the call will be included in the stacktrace. For example: 1> catch abs(lists:seq(1, 1000)). {'EXIT',{badarg,[{erlang,abs, [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20|...]], []}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,431}]}, {shell,exprs,7,[{file,"shell.erl"},{line,687}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]}} 2> erlang:get_stacktrace(). [{erlang,abs, [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, 23,24|...]], []}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,431}]}, {shell,exprs,7,[{file,"shell.erl"},{line,687}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}] 3> We can extend the syntax for clauses in try/catch to optionally bind the stacktrace to a variable. Here is an example using the current syntax: try Expr catch C:E -> Stk = erlang:get_stacktrace(), . . . In the new syntax, it would look like: try Expr catch C:E:Stk -> . . . Only a variable (not a pattern) is allowed in the stacktrace position, to discourage matching of the stacktrace. (Matching would also be expensive, because the raw format of the stacktrace would have to be converted to the cooked form before matching.) Note that: try Expr catch E -> . . . is a shorthand for: try Expr catch throw:E -> . . . If the stacktrace is to be retrieved for a throw, the 'throw:' prefix must be explicitly included: try Expr catch throw:E:Stk -> . . .
2017-11-28Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Extend the map implementation's handling of ?unit dialyzer: Use string:find() instead of string:str()
2017-11-22dialyzer: Extend the map implementation's handling of ?unitHans Bolinder
The Maps implementation handles ?unit in more cases. Exactly when t_is_none_or_unit() is to be called is not clear to me. The added cases are about a map type being ?unit, but the key or the value of an association can also be ?unit, but that is not always checked.
2017-11-14Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Display error messages without call stack
2017-11-10dialyzer: Display error messages without call stackHans Bolinder
As of commit 12b379 many of the reasons displayed after "Analysis failed with error:" erroneously include a call stack. The bug is now corrected. The bug was pointed out in http://erlang.org/pipermail/erlang-questions/2017-October/093838.html.
2017-09-20Merge branch 'maint'Dan Gudmundsson
* maint: erts, stdlib: Fix xmllint warning Update runtime deps to depend on new stdlib functionality
2017-09-19Update runtime deps to depend on new stdlib functionalityDan Gudmundsson
~tw and new string functions are new since OTP-20 (stdlib-3.4)
2017-09-15Merge branch 'siri/string-new-api'Siri Hansen
* siri/string-new-api: (28 commits) hipe (test): Do not use deprecated functions in string(3) dialyzer (test): Do not use deprecated functions in string(3) eunit (test): Do not use deprecated functions in string(3) system (test): Do not use deprecated functions in string(3) system (test): Do not use deprecated functions in string(3) mnesia (test): Do not use deprecated functions in string(3) Deprecate old string functions observer: Do not use deprecated functions in string(3) common_test: Do not use deprecated functions in string(3) eldap: Do not use deprecated functions in string(3) et: Do not use deprecated functions in string(3) os_mon: Do not use deprecated functions in string(3) debugger: Do not use deprecated functions in string(3) runtime_tools: Do not use deprecated functions in string(3) asn1: Do not use deprecated functions in string(3) compiler: Do not use deprecated functions in string(3) sasl: Do not use deprecated functions in string(3) reltool: Do not use deprecated functions in string(3) kernel: Do not use deprecated functions in string(3) hipe: Do not use deprecated functions in string(3) ... Conflicts: lib/eunit/src/eunit_lib.erl lib/observer/src/crashdump_viewer.erl lib/reltool/src/reltool_target.erl
2017-09-15Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Improve check of unknown types
2017-09-15dialyzer: Improve check of unknown typesHans Bolinder
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.
2017-09-12Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Do not fix ETS tables when merging PLTs
2017-09-12dialyzer: Do not fix ETS tables when merging PLTsHans Bolinder
This commit removes the call to ets:safe_fixtable/2 introduced in commit 9458495. ETS memory can now be reclaimed while merging PLTs.
2017-09-07Merge branch 'maint'Siri Hansen
2017-09-05dialyzer: Improve handling of UnicodeHans Bolinder
2017-08-25Merge branch 'maint'Henrik Nord
2017-08-24dialyzer: Fix a bug where merging PLT:s could lose infoHans Bolinder
A missing call to ets:safe_fixtable/2 meant that information was sometimes lost when merging PLT:s.
2017-07-06dialyzer: Do not use deprecated functions in string(3)Hans Bolinder
2017-07-04No longer support OTP 19 beam files in DialyzerJosé Valim
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.
2017-06-13dialyzer: Run more of analyses in subprocessHans Bolinder
Memory consumption is marginally reduced.
2017-06-13dialyzer: Do not use two records for PLTsHans Bolinder
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).
2017-06-13dialyzer: Improve compression of an ETS tableHans Bolinder
2017-06-13dialyzer: Minor optimizationsHans Bolinder
Avoid some ETS-lookups. Marginal speed-ups.
2017-06-13dialyzer: Warn about unused unknown typesHans Bolinder
2017-06-13dialyzer: Correct a mistakeHans Bolinder
The arguments of calls to a debug function are no longer evaluated.
2017-06-13dialyzer: Rearrange some code to save memoryHans Bolinder
2017-06-13dialyzer: Optimize by avoiding some table lookupsHans Bolinder
In typesig: do not look up the module's types unless it is necessary.
2017-06-09dialyzer: Improve handling of UnicodeHans Bolinder
2017-05-04Update copyright yearRaimo Niskanen
2017-05-02Merge branch 'maint'Hans Bolinder
* maint: Updated OTP version Prepare release inets: Add missing release note dialyzer: Fix a bug regarding unknown types erl_mseg.c: don't use invalid indices in - > cache_powered_node[] Fix release note for OTP-14290 Conflicts: OTP_VERSION erts/emulator/sys/common/erl_mseg.c erts/vsn.mk lib/dialyzer/src/dialyzer_analysis_callgraph.erl
2017-04-27dialyzer: Fix unknown typeHans Bolinder
Due to a bug in Dialyzer, unknown types have been introduced.
2017-04-26dialyzer: Fix a bug regarding unknown typesHans Bolinder
Since commit 12b3790 Dialyzer has not reported unknown types.
2017-04-25Store abstract code in the Dbgi chunkJosé Valim
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.
2017-04-21Merge branch 'bjorn/dialyzer/add-typer/OTP-14336' into run-travisBjörn Gustavsson
* bjorn/dialyzer/add-typer/OTP-14336: Add smoke test for TypER Add back TypEr to the main OTP repository
2017-04-20Add back TypEr to the main OTP repositoryBjörn Gustavsson
It turned out that the dependencies between Dialyzer and TypEr makes it impractical to have TypEr in a separate repository. Add it back to the OTP repository, but put the Erlang module 'typer' in the dialyzer application.