Age | Commit message (Collapse) | Author |
|
* egil/maps/variable-keys/OTP-12218: (22 commits)
compiler: Update test for Maps aliasing
compiler: Properly support Map aliasing
compiler: Refactor Map pairs aliasing
compiler: Fix harmless need_heap error for Maps
stdlib: Update Map tests
stdlib: Use environment bindings for Maps keys in erl_eval matching
debugger: Update Map tests
compiler: Update Map tests
compiler: Fix v3_core Maps pair chains
compiler: Use expressions in core patterns
compiler: Use variables in Map cerl inliner
compiler: Reintroduce binary limit for Map keys
compiler: Shameless v3_core hack for variables
compiler: Use variables in Map beam assmebler
compiler: Use variables in Map kernel pass
compiler: Use variables in Map core pass
compiler: Normalize unary ops on Maps key literals
stdlib: Update Map tests
stdlib: erl_lint Map key variables
compiler: Maps are always patterns never values in matching
...
|
|
Matching of type:
#{K := V1} = #{K := V2} = M,
Will alias (coalesce) to
#{K := V1 = V2} = M.
|
|
|
|
Need heap for maps is zero and fall through is also zero.
|
|
|
|
The scope is supposed to contain all variables that are currently
live. We need this information for certain optimizations to
avoid capturing a name (a name that is in the scope must be renamed;
for an example, see move_let_into_expr/2 or any function that calls
sub_subst_scope/1). We also use the scope to optimize sub_del_var/2
and sub_is_val/2.
When optimizing case expressions, the scope could be reset to an
empty list (because sub_new/0 was called instead of sub_new/1).
That could cause name capture if inlining was turned on.
As simple way to force this bug is to uncomment the
"-define(DEBUG, 1)." near the beginning of the file. Without this
correction, most files in the test suite fail to compile.
|
|
Check for literals instead of variables when constructing chains.
|
|
Two patterns, binary_segment size and map_pair key, are expressions
even in matching. If only bound variables are used we are fine but
some expressions which appears as literals needs to be lifted.
Currently only Map key binaries will use this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Unary ops are normalized before core transformation, i.e. handle
negative integers as map keys.
Strictly speaking, map keys are expressions but by handling them as
patterns we can normalize negative integers.
|
|
* nox/compiler/improve-core-lint:
Remove obsolete comment in core_lint
Handle return mismatches for calls and primops
Check for more return mismatches
Use +clint0 in compiler's test suites
|
|
|
|
Only exit BIFs and the match_fail primop are allowed to run where more than one
value is expected.
|
|
All expressions but calls and primops are now checked for return mismatches.
|
|
Removed dead code.
|
|
|
|
Key and value were interchanged.
|
|
* 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.
|
|
|
|
* egil/fix-maps-pretty-layout/OTP-11947:
dialyzer: Add Maps type mismatch test
hipe,compiler: Fix Map literals pretty printing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* egil/maps-compiler-coverage:
compiler: Do not evaluate map expressions with bad keys
compiler: Throw 'nomatch' on matching with bad binary keys
compiler: Variable keys are not allowed in Maps
compiler: Strengthen Maps warnings tests
compiler: map_pair cannot be a type clause in v3_life
compiler: Remove redudant code in v3_codegen
compiler: Test deep map structure
compiler: Remove redundant clause in v3_codegen
compiler: Cover #{ [] => Var } in testcase
|
|
Map keys with large (non literal) binary keys must fail.
|
|
Even if a binary key is written as a literal the compiler may
choose to make an expression. Emit a warning in those cases
and saying the case will not match.
This is a limitation in current implementation.
|
|
No need to check for variables in Map keys.
|
|
Map pairs are encapsulated in a map.
|
|
The pass sys_core_fold did not correctly handle non-matching patterns in code
such as:
0 = case <<>> of
<<>> -> 0;
a -> 1
end.
Function case_opt_lit/3 is rewritten in two passes to first remove any
non-matching clause and only then potentially remove the related patterns
in each clause.
Reported-by: Ulf Norell
|
|
|
|
Multiple 'nil' cannot happen on instruction level.
Map keys are always unique with literals.
|
|
Most dependencies introduced are exactly the dependencies to other
applications found by xref. That is, there might be real dependencies
missing. There might also be pure debug dependencies listed that
probably should be removed. Each application has to be manually
inspected in order to ensure that all real dependencies are listed.
All dependencies introduced are to application versions used in
OTP 17.0. This since the previously used version scheme wasn't
designed for this, and in order to minimize the work of introducing
the dependencies.
|
|
* ks/cerl-type-fixes:
Restore the alphabetical order of Core Erlang records
Clean up the types of cerl
|
|
* nox/maps-v3_core-lit_vars:
Properly collect variables in map expressions in v3_core
|
|
* bjorn/compiler/utf8-warning/OTP-11791:
Don't fail compilation for modules that contain invalid UTF-8
epp: Make it possible to specify a default encoding
|
|
The introduction of c_map{} and c_map_pair{} unnecessarily broke the
alphabetical order of Core Erlang records. They were probably placed
at the end of the file so as to use other records as types. There is
really no need for this since 'cerl' contains appropriate definitions
of types that can be used for this purpose.
While at it, a type declaration to the c_binary{} definition was added.
|
|
The introduction of c_map and c_map_pair was not done properly. In
particular, the definition of ctype() and an important Edoc comment
were not up-to-date.
While at it,
- some more types were cleaned up and exported so as to be used
in core_parse.hrl and
- some obviously dead code was removed (the type/1 function does
not return 'nil', which in turn simplified a clause in the code
of meta_1/2).
|
|
The default encoding for Erlang modules is now UTF-8, and the
compilation would fail if a module contained byte sequences that
are not valid UTF-8 sequences.
In a large project with say many hundreds of Erlang modules
with names of developers such as "Björn" or "Håkan" encoded in
latin-1, that could mean that many hundreds of files would need
to be modified just to get started testing OTP 17.
As a temporary measure to ease the transition, automatically
fall back to the latin-1 encoding with a warning for any module
that contains invalid byte sequences and for which no encoding
has been specified.
The intention is to remove this workaround in OTP 18 or 19.
|