Age | Commit message (Collapse) | Author |
|
This complements the `map_get/2` guard BIF introduced in #1784.
Rationale.
`map_get/2` allows accessing map fields in guards, but it might be
problematic in more complex guard expressions, for example:
foo(X) when map_get(a, X) =:= 1 or is_list(X) -> ...
The `is_list/1` part of the guard could never succeed since the
`map_get/2` guard would fail the whole guard expression. In this
situation, this could be solved by using `;` instead of `or` to separate
the guards, but it is not possible in every case.
To solve this situation, this PR proposes a `is_map_key/2` guard that
allows to check if a map has key inside a guard before trying to access
that key. When combined with `is_map/1` this allows to construct a
purely boolean guard expression testing a value of a key in a map.
Implementation.
Given the use case motivating the introduction of this function, the PR
contains compiler optimisations that produce optimial code for the
following guard expression:
foo(X) when is_map(X) and is_map_key(a, X) and map_get(a, X) =:= 1 -> ok;
foo(_) -> error.
Given all three tests share the failure label, the `is_map_key/2` and
`is_map/2` tests are optimised away.
As with `map_get/2` the `is_map_key/2` BIF is allowed in match specs.
|
|
* sverker/monitor-send-combo:
erts: Optimize monitor signal by message piggyback
|
|
If no message/signal is sent (to same destination)
then monitor signal is flushed when process is scheduled out.
|
|
|
|
* rickard/dirty-schedulers-test-fix/OTP-15046:
Do not run tests that conflicts with dirty schedulers test
|
|
* siri/upgrade_SUITE/stop-inets-before-start-ftp:
Add correction of relup when upgrading from 20-21 with inets and ftp/tftp
|
|
Allow installing multiple instances of sys debug function
This commit solves a bug which allowed installing {Fun,State} as sys debug function even if Fun was already installed. This happened in the case when the current State of the debug fun was undefined.
Also, the new format {Id,Fun,State} of debug functions can be installed, allowing multiple instances of the same fun.
|
|
[stdlib/sys.erl] Fix sys module's debug statistics not including the out message count when using gen_server:call/2.
OTP-15047
|
|
* hasse/stdlib/calendar_systemtime/OTP-13413:
stdlib: Add system time functions to module calendar
|
|
* hans/crypto/EVP_DH_key/OTP-14864:
crypto: Test case with a failing Pub/Priv/P/G combination This quadruple is from a failing test when trying to EVP-ify the dh functions.
crypto: Use EVP-api in dh_compute_key_nif and dh_generate_key_nif
|
|
This quadruple is from a failing test when trying to EVP-ify the dh functions.
|
|
|
|
* rickard/process_info/OTP-14966:
Restore merge of signal queues in queue_messages() if main lock is held
Fix message tracing
|
|
Rewrite a call of a literal external fun to a direct call
OTP-15044
|
|
* bjorn/compiler/misc:
beam_validator: Clear X registers in wait_timeout
sys_core_fold: Eliminate crash for map update in guard
|
|
* hans/ssh/cuddle_tests:
ssh: Better logging in test case
|
|
* hans/ssh/doc_changes/OTP-15030:
public_key: Add markers for private and public keys
crypto: Add marker for engine_ref
ssh: Use -spec and -type for documentation generation
|
|
|
|
|
|
|
|
* hasse/stdlib/chars_limit_io/OTP-14983:
stdlib: Modify the printing of map associations with wWpP
stdlib: Introduce characters limit of formated strings
stdlib: Modify ~w/~W when number of characters is limited
stdlib: io_lib{_pretty}: Avoid tuple_to_list when possible
stdlib: Introduce characters limit of formatted strings
|
|
Use the same depth for all (printed) elements of a map.
Since the order of keys can vary when printing a map--maps:iterator/1
and maps:next/1 are used--it is more consistent to print all
associations with the same depth.
If the associations printed are limited by the depth, the selection
of associations is arbitrary, as before.
|
|
Inspiration from module lager_format.
Also some improvements of Unicode handling.
io_lib:format/3 and io_lib:fwrite/3 are new functions. The
representation of the options is a list, but we are considering using
a map instead. If we change, it will happen after Erlang/OTP 21.0-rc1
is released.
|
|
Remove config test of MAP_NORESERVE for hipe on x86_64
|
|
|
|
* hans/ssh/type_changes/OTP-15002:
ssh: Changes suggested by dialyzer
ssh: New -spec and -type
|
|
|
|
|
|
|
|
|
|
Rewrite calls such as:
(fun erlang:abs/1)(-42)
to:
erlang:abs(-42)
While we are at it, also add rewriting of apply/2 with a fixed
number of arguments to a direct call of the fun. For example:
apply(F, [A,B])
would be rewritten to:
F(A, B)
https://bugs.erlang.org/browse/ERL-614
|
|
A bug fix: limited maps end with "...", not "...=>...".
A modification: wW separate pairs with " => ", not "=>".
When the output is limited on number of characters, the term is
balanced by wW the same way as is done with pP (see commit bc38638).
|
|
|
|
The name of the io_lib_pretty:print/2 option 'max_chars' is changed to
'line_max_chars' (used by module shell only).
The new option for limiting the number of returned characters of
io_lib_pretty:print() is called 'chars_limit'.
|
|
* hasse/stdlib/map_guards_shell/OTP-15035/ERL-613:
erts: Correct abstract format doc regarding map creation
stdlib: Correct the linter's check of map guard expressions
|
|
Do not use lists:concat where lists:append is intended
|
|
Help us find more compiler bugs.
|
|
sys_core_fold would crash when attempting to optimize this code:
t() when (#{})#{}->
c.
|
|
|
|
|
|
* 'map-get-bif' of git://github.com/michalmuskala/otp:
Introduce map_get guard-safe function
OTP-15037
|
|
IngelaAndin/ingela/ssl/hello-pause/ERL-169/OTP-14372
Add new API functions to enable smoother user customizations based on TLS hello extensions
|
|
* lukas/erts/poll-thread/OTP-14346:
erts: nif resource stop from poll-thread is a indirect call
|
|
* lukas/erts/dump_SUITE_fix:
erts: Increase file read timeout for signal_abort test
|
|
* john/erts/fix-lcnt-toggle-test:
Disregard locks that can't be toggled in lcnt_SUITE
|
|
Improve memory instrumentation
OTP-15024
OTP-14961
|
|
|
|
The check is used by evaluating modules such as erl_eval.
An example: "if map_size(#{}) =:= 0 -> ok end.".
|
|
* raimo/stdlib/gen_statem-dev/OTP-14015:
Fix after feedback
Improve pointer to User's Guide
Fix after feedback on 'When to use'
Add a 'When to use' section
Fix timeout parsing and doc feedback
Improve doc, change images to .svg
erl_docgen: Implement width in image tag
Update User's Guide and pointers to it
Improve error reasons from state enter call
|
|
* maint:
Updated OTP version
Prepare release
ssh: Fix server crashes for exit-normal signals
|