aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test
AgeCommit message (Collapse)Author
2019-02-21dialyzer: Fix maps as parameter of opaque typesHans Bolinder
The clause added for maps in commit 1a7c41be is corrected.
2019-02-21dialyzer: Fix key check of lists:key{search,member,find}()Hans Bolinder
Replace integers and floats with t_number() since keysearch et al compare the key (rather than match). Corrects the commit b3c8e94.
2019-02-19Merge branch 'hasse/dialyzer/fix_contract_check/OTP-15562/ERL-845' into maintHans Bolinder
* hasse/dialyzer/fix_contract_check/OTP-15562/ERL-845: dialyzer: Fix a bug regarding contracts
2019-02-08dialyzer: Fix a bug affecting keyfind/keysearch/keymemberHans Bolinder
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-08-28dialyzer: Improve handling of complex guardsHans Bolinder
See also https://bugs.erlang.org/browse/ERL-680. The right associative short circuit expressions 'andalso' and 'orelse' are expanded by the Compiler (see v3_core) into 'case' expressions. If parentheses are used to enforce left associativeness, variables are introduced, and the time needed by Dialyzer increases exponentially. Rather than trying to fix Dialyzer itself, v3_core now rewrites repeated use of 'andalso' ('orelse') into right associative expressions before creating the 'case' expressions.
2018-06-07stdlib: Move eval_str/1 from mod_esi to erl_evalHans Bolinder
See also https://bugs.erlang.org/browse/ERL-634. The utility program `erl_call' in erl_interface used to call lib:eval_str/1, which is no longer present in Erlang/OTP 21.0. The lib module was eliminated in OTP-15072, see also https://github.com/erlang/otp/pull/1786.
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-21Merge branch 'hasse/dialyzer/funs_in_dead_code/OTP-15079/ERL-593'Hans Bolinder
* hasse/dialyzer/funs_in_dead_code/OTP-15079/ERL-593: dialyzer: Do not emit warnings for unreachable funs
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-05-09Fix minor issuesRichard Carlsson
2018-05-04Use \n escape instead of integer 10Richard Carlsson
2018-05-04Move lib:eval_str/1 into mod_esi.erlRichard Carlsson
2018-05-04Move lib:nonl/1 into yecc.erlRichard Carlsson
2018-03-24Avoid overflowing the atom tableBjörn Gustavsson
Use integer variable names instead of atoms in v3_core, sys_core_fold, and v3_kernel to avoid overflowing the atom table. It is a deliberate design decision to calculate the first free integer variable name (in sys_core_fold and v3_kernel) instead of somehow passing it from one pass to another. I don't want that kind of dependency between compiler passes. Also note that the next free variable name is not easily available after running the inliner.
2018-03-16mikpe/process_info-1-no-messages/PR-1745/OTP-14986Lukas Larsson
make erlang:process_info/1 not retrieve messages
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-03-10make erlang:process_info/1 not retrieve messagesMikael Pettersson
process_info/1 retrieves a number of properties related to a process, including the list of messages in its mailbox. This is potentially unsafe if the target process has a large number of queued messages: - there is no a priori upper bound on the amount of memory being allocated to hold that list, and - the loop to retrieve the messages is uninterruptible, so the Erlang scheduler where this executes blocks for the duration We've seen process_info/1 bring down heavily loaded nodes on more than one occasion. At least once it appeared to have blocked the Erlang heart process from executing, causing the external heart to kill the VM. Consequently this removes 'messages' from the list of process_info tags to retrieve for process_info/1. Note that process_info/1 still retrieves 'message_queue_len', and process_info/2 can still retrieve 'messages' when asked to. A few places in the OTP libraries need minor adjustments, since they want 'message_queue_len' but compute it from the length of the list of messages.
2018-02-23Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Correct a parameterized opaque types bug
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-19Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Fix bsl/2 bug
2018-01-12dialyzer: Fix bsl/2 bugHans Bolinder
Also modified erl_bif_types:infinity_bsl() when called with zero as first argument. As of writing this, erlang:'bsl'/2 is modified on the master branch to never fail if called with a huge second argument.
2018-01-10Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Add a test of erl_tar:table/1,2 Fix false Dialyzer warnings for erl_tar:table/1
2018-01-09dialyzer: Add a test of erl_tar:table/1,2Hans Bolinder
2018-01-09Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Correct handling of erlang:abs/1
2018-01-08dialyzer: Correct handling of erlang:abs/1Hans Bolinder
See also https://bugs.erlang.org/browse/ERL-551.
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-22dialyzer: Use string:find() instead of string:str()Hans Bolinder
2017-11-20Merge branch 'lukas/stdlib/maps_iterators/OTP-14012'Lukas Larsson
* lukas/stdlib/maps_iterators/OTP-14012: erts: Limit size of first iterator for hashmaps Update primary bootstrap Update preloaded modules erts: Remove erts_internal:maps_to_list/2 stdlib: Make io_lib and io_lib_pretty use maps iterator erts: Implement batching maps:iterator erts: Implement maps path iterator erts: Implement map iterator using a stack stdlib: Introduce maps iterator API Conflicts: bootstrap/lib/stdlib/ebin/io_lib.beam bootstrap/lib/stdlib/ebin/io_lib_pretty.beam erts/emulator/beam/bif.tab erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/zlib.beam
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-10-13erts: Implement maps path iteratorLukas Larsson
2017-09-18Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Adjust a test case dialyzer: Modify handling of singleton map key types Dialyzer: Rewrite one map type invariant Dialyzer: Rewrite some of the docs of map types
2017-09-18Merge branch 'hasse/dialyzer/map_fixes/OTP-14572' into maintHans Bolinder
* hasse/dialyzer/map_fixes/OTP-14572: dialyzer: Adjust a test case dialyzer: Modify handling of singleton map key types Dialyzer: Rewrite one map type invariant Dialyzer: Rewrite some of the docs of map types
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-15dialyzer (test): Do not use deprecated functions in string(3)Dan Gudmundsson
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-12dialyzer: Adjust a test caseHans Bolinder
Huge maps are truncated differently by the pretty printer. The reason is that erl_types:is_singleton_type/1 no longer recognizes complex singleton types, which results in a less precise representation of map types.
2017-09-12dialyzer: Modify handling of singleton map key typesHans Bolinder
The test case loop.erl shows that there is a problem with certain singleton key types. Here the internal representation toggles between #{a | b => ...} and #{a => ..., b => ...} The choice is to turn #{a | b => ...} into #{a => ..., b => ...} early (t_from_form()). The aim is to keep as much info as possible (in pairs). However, including complex singleton keys (tuples, maps) in this scheme is potentially too costly, and a bit complicated. So one more choice is made: let atoms and number (and nothing else) be singleton types, and let complex keys go into the default key.
2017-08-05Add {continue, Term} and handle_continue/2 to gen_serverJosé Valim
If the gen_server process needs to perform an action immediately after initialization or to break the execution of a callback into multiple steps, it can return {continue, term()} in place of the time-out or hibernation value, which will immediately invoke the handle_continue/2 callback with the given term. This provides a more accessible approach to after initialization compared to proc_lib+enter_loop that is also guaranteed to be safe. It also allows callbacks that need to do lengthy or stateful work to checkpoint the state throughout multiple iterations. This can be useful, for example, when implementing behaviours on top of gen_server.
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: Warn about unused unknown typesHans Bolinder