aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl/erl_types.erl
AgeCommit message (Collapse)Author
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.
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-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-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: 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-09-12Dialyzer: Rewrite one map type invariantHans Bolinder
2017-06-13hipe: Remove 'undefined' from a record field's typeHans Bolinder
2017-06-13hipe: Remove use of 'catch'Hans Bolinder
Substitute try/catch for an obsoletely used catch. Thanks to Kostis for pointing it out.
2017-06-13hipe: Optimize contract decoration somewhatHans Bolinder
2017-06-13hipe: Correct a typespecHans Bolinder
2017-06-09dialyzer: Improve handling of UnicodeHans Bolinder
2017-05-22dialyzer: Warn for bad type variables of parameterized typesHans Bolinder
As of commit 854ee8b (Erlang/OTP 18) warnings about using '_' as type variable in parameterized types have not been output. The code of erl_types:t_var_names() is corrected. The spec is also corrected (thanks to Kostis for pointing out the bug).
2017-03-06Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Improve a warning dialyzer: Fix a weird warning dialyzer: Fix an opaque bug dialyzer: Minor fix Conflicts: lib/dialyzer/src/dialyzer_dataflow.erl
2017-02-28dialyzer: Improve a warningHans Bolinder
When a pattern a type do not match, opaque warnings were given precedence before structure mismatches. This is no longer always the case. Mentioned by Nick Marino on erlang-questions.
2017-02-28dialyzer: Fix a weird warningHans Bolinder
2017-02-03dialyzer: Do not keep the code server's type info on the heapHans Bolinder
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.
2017-02-03Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Increase time limit for tests dialyzer: Optimize typesig dialyzer: Optimize evaluation of complex code dialyzer: Optimize collection of variables Conflicts: lib/dialyzer/src/dialyzer_typesig.erl
2017-02-01dialyzer: Optimize collection of variablesHans Bolinder
2017-01-12Merge branch 'maint'Hans Bolinder
* 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
2017-01-11dialyzer: Use maps instaed of dictHans Bolinder
2017-01-11Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Fix check of parameterized opaque types Conflicts: lib/hipe/cerl/erl_types.erl
2017-01-11Merge branch 'hasse/dialyzer/fix_opaque_parms/OTP-14130' into maintHans Bolinder
* hasse/dialyzer/fix_opaque_parms/OTP-14130: dialyzer: Fix check of parameterized opaque types
2017-01-10Merge branch 'maint'Hans Bolinder
* maint: stdlib: Allow characters in types and constant patterns
2017-01-10dialyzer: Fix check of parameterized opaque typesHans Bolinder
Two parameters used to be "compatible" if one is a specialization of the other, in the way that the input type of t_limit() is a specialization of the output type. This check is now relaxed: any() in any of the two parameters is compatible with any type of the other parameter. The change is due to bugus warnings. A clause for maps has been added.
2016-12-21stdlib: Allow characters in types and constant patternsHans Bolinder
Characters ($char) can be used in constant pattern expressions. They can also be used in types and contracts.
2016-11-23Update obsolete author e-mailsRichard Carlsson
2016-11-23Correct copyright info on hipe cerl filesRichard Carlsson
2016-11-22dialyzer: Substitute 'opacity' for 'opaqueness'Hans Bolinder
Suggested by Kostis.
2016-10-06dialyzer: Fix opaque bugHans Bolinder
The "decoration" of opaque types works better than before when opaque types are used by other opaque types.
2016-10-06dialyzer: Fix opaque bugsHans Bolinder
t_from_form() sometimes returned a more general type than it should have done due to a bug in from_form_loop(): it stopped when the limit was exceeded, which could mean a collapsed type. Returning a type with smaller depth should fix this. is_specialization() now handles opaque types before unions, which should fix another problem. The bugs reported by Kostis.
2016-09-12Merge branch 'margnus1/dialyzer/fix_maps_opaque/ERL-249/PR-1161/OTP-13878' ↵Hans Bolinder
into maint * margnus1/dialyzer/fix_maps_opaque/ERL-249/PR-1161/OTP-13878: erl_bif_types: Properly unopaque maps:merge/2 args
2016-09-07erl_bif_types: Properly unopaque maps:merge/2 argsMagnus Lång
erl_bif_types:type/5 was calling erl_types:map_pairwise_merge/3 directly with its (potentially opaque) arguments, causing Dialyzer crashes. Bug (ERL-249) reported and minimised test case provided by Felipe Ripoll.
2016-09-05hipe: Fix erl_types opaque match orderBjörn-Egil Dahlberg
2016-08-31dialyzer: Optimize an opaque type caseHans Bolinder
Fix a mistake in commit 85f6fe3b. Instead of using the declared opaque type, the form's type is used in a case where the opaque type is turned into a non-opaque type. The result is more general types (smaller Erlang terms) and faster analyses.
2016-06-28erl_types: Normalise X:=none() pairs in t_map/3Magnus Lång
t_map/3 previously required callers to perform this normalisation, but as t_from_form/5 would sometimes fail to do so, this requirement is relaxed. Bug (ERL-177) reported and shrunk by Luke Imhoff.
2016-06-10Merge branch 'hasse/dialyzer/improve_from_form/OTP-13547'Hans Bolinder
* hasse/dialyzer/improve_from_form/OTP-13547: Update primary bootstrap stdlib: Correct types and specs dialyzer: Minor adjustments dialyzer: Suppress unmatched_return for send/2 dialyzer: Improve the translation of forms to types dialyzer: Use a cache when translating forms to types dialyzer: Prepare erl_types:t_from_form() for a cache dialyzer: Optimize erl_types:t_form_form() dialyzer: Correct types syntax_tools: Correct types erts: Correct character repr in doc of the abstract format stdlib: Correct types and specs
2016-06-09Remove support for '...' in Maps typesHans Bolinder
It is possible that '...' is added later (OTP 20.0), but for now we are not sure of all details.
2016-06-09dialyzer: Improve the translation of forms to typesHans Bolinder
Spend less of the limited resources on recursive types.
2016-06-09dialyzer: Use a cache when translating forms to typesHans Bolinder
2016-06-09dialyzer: Prepare erl_types:t_from_form() for a cacheHans Bolinder
No change of functionality.
2016-06-09dialyzer: Optimize erl_types:t_form_form()Hans Bolinder
When the translation from forms to types exceeds some limit, it is faster to try small depths first.
2016-06-09dialyzer: Correct typesHans Bolinder
2016-05-31Fix name of compiler option and the related warningsKostis Sagonas
2016-05-04Declare the erl_types:var_table() type as opaqueKostis Sagonas
and do the following changes: in erl_types: export the type and an appropriate constructor for it in dialyzer_contracts: perform all necessary code modifications to fix all dialyzer warnings Although no warnings are reported by dialyzer, it's quite possible that these are not the only places where the opacity of the var_table() data structure is violated. But I decided to leave these places for a better version of dialyzer to discover...
2016-05-04hipe: Use maps for unification and substitutionHans Bolinder
2016-05-04dialyzer: Use maps instead of dictHans Bolinder
Optimization: A few dictionaries are maps instead of dicts.
2016-04-29dialyzer: Fix a bug in the translation of forms to typesHans Bolinder
A bug is fixed, but there are more problems. Modify erl_types.erl like this: -define(EXPAND_LIMIT, 500). and bogus warnings are output (again). Callbacks and specs are compared (subtype) in dialyzer_behaviour. If they are expanded to different depths, then invalid warnings can be generated.
2016-04-28erl_types: Don't consider opaque keys singletonMagnus Lång
Opaque singleton keys have the unfortunate property, unlike any other singleton type, to overlap with other singleton types that do not have the same internal representation. Therefore, we must not keep opaque singletons in the Pairs list in a map type.
2016-04-28erl_types: Fix t_subtract/2 correctness bugMagnus Lång
t_subtract/2 would break its postcondition by always returning the underapproximation none() when given a variable on the right hand side. This broke map type parsing, since it relied on t_subtract/2 to tell it when map keys would shadow each other.
2016-04-28erl_types: Fix crash merging maps with opaque keysMagnus Lång
Opaque keys in maps broke an assumption in erl_types:mapmerge_otherv/3 (that the infinimum of a singleton type and some other type would either be none() or that same singleton type), causing a case_clause crash.