Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
|
|
* hasse/dialyzer/fix_opaque_parms/OTP-14130:
dialyzer: Fix check of parameterized opaque types
|
|
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.
|
|
Characters ($char) can be used in constant pattern expressions. They
can also be used in types and contracts.
|
|
Suggested by Kostis.
|
|
The "decoration" of opaque types works better than before when opaque
types are used by other opaque types.
|
|
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.
|
|
into maint
* margnus1/dialyzer/fix_maps_opaque/ERL-249/PR-1161/OTP-13878:
erl_bif_types: Properly unopaque maps:merge/2 args
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
The Core Erlang pattern matching compiler was written long ago, at
a time when binaries and bistrings did not really exist in Erlang.
This patch, taken from the code of CutEr where it's used for more
than a year now, extends the transformation for pattern matching
compilation to also include binaries and bistrings.
Some code that was found erroneous and causes errors when compiling
the transformed code to native code was also taken out while at it.
Thanks to @aggelgian for most of the changes in the code.
|
|
* 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
|
|
It is possible that '...' is added later (OTP 20.0), but for now we
are not sure of all details.
|
|
Spend less of the limited resources on recursive types.
|
|
|
|
No change of functionality.
|
|
When the translation from forms to types exceeds some limit, it is
faster to try small depths first.
|
|
|
|
|
|
Removed in f9cb80861f169743 when changed impl from C to Erlang.
But seems they are needed to keep dialyzer tests happy.
Also improved bif_SUITE:shadow_comments to include all exported
in module erlang, not just the "snifs".
...which detected that apply/2 was missing Shadowed comment as well.
|
|
just to make things simpler.
|
|
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...
|
|
|
|
Optimization: A few dictionaries are maps instead of dicts.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
* maps:from_list/1
* maps:get/2
* maps:is_key/2
* maps:merge/2
* maps:put/3
* maps:size/1
* maps:to_list/1
* maps:update/3
|
|
The type of a map is represented as a three-tuple {Pairs, DefaultKey,
DefaultValue}. DefaultKey and DefaultValue are types. Pairs is a list of
three-tuples {Key, mandatory | optional, Value}, where Key and Value are
types. All types Key must be singleton, or "known at compile time," as
the EEP put it. Examples:
#{integer()=>list()} {[], integer(), list()}
#{a=>char(), b=>atom()} {[{a, optional, char()},
{b, optional, atom()}],
none(), none()}
map() {[], any(), any()}
A more formal description of the representation and its invariants can
be found in erl_types.erl
Special thanks to Daniel S. McCain (@dsmccain) that co-authored a very
early version of this with me back in April 2014, although only the
singleton type logic remains from that version.
|
|
|
|
* maint:
dialyzer: Correct byte_size() and comparisons
Conflicts:
lib/hipe/cerl/erl_bif_types.erl
|
|
The argument of byte_size() is a bitstring().
The code in erl_bif_types that finds cases where comparisons always
return true or false is corrected when it comes to maps and bit
strings.
|
|
Conflicts:
erts/emulator/beam/beam_emu.c
|
|
* margnus1/bs_unit_fix:
hipe: Fix signed compares of unsigned sizes
beam: Fix overflow bug in i_bs_add_jId
hipe: Add tests for bad bit syntax float sizes
Add a case testing the handling of guards involving binaries
Add some more binary syntax construction tests
hipe: Guard against enormous numbers in ranges
hipe: Fix constructing huge binaries
hipe: Fix binary constructions failing with badarith
Add missing corner-case to bs_construct_SUITE
hipe: Allow unsigned args in hipe_rtl_arith
hipe: test unit size match in bs_put_binary_all
hipe: test unit size match in bs_append
Fix hipe_rtl_binary_construct:floorlog2/1
OTP-13272
|
|
Parameterized modules are no longer supported, so module() can only be
an atom().
|
|
|
|
|
|
|
|
* egil/improve-map-cerl-prettypr/OTP-13238:
compiler, hipe: Fix pretty printing of Core Maps
hipe: Fix map pretty printing of pairs
dialyzer: Update Maps tests
|
|
* maint:
dialyzer: Correct handling of parameters of opaque types
|
|
Correction of commit d57f5e.
|
|
Literal maps could cause dialyzer to crash when pretty printing the results.
Reported-by: Chris McGrath <[email protected]>
|
|
In commit f667931e2905797ffab63e224e56eaf07f77178a the core format changed
for map pairs. Let dialyzer and hipe pretty printing of maps also adhere to
those changes.
An Erlang map update, M#{foo := 1, bar => 2} will now be printed as:
~{ 'foo' := 1, 'bar' => 2 | M }~
|
|
The unit size field was previously completely discarded when lowering
this instruction from BEAM to Icode.
This feature was previously missing and expressions such as <<0,
<<1:1>>/binary>> would succeed construction when compiled with HiPE.
|