diff options
author | Björn Gustavsson <[email protected]> | 2015-01-27 06:49:52 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-01-28 09:48:39 +0100 |
commit | 11dcd4774a6beb28306b9e6e1b80b00d9596bf5f (patch) | |
tree | 3efd898883f790989528492916c4976bb266ecdb /lib/compiler/src/cerl.erl | |
parent | 81d728c44774a4e0367b30d377ac9f136ecf853e (diff) | |
download | otp-11dcd4774a6beb28306b9e6e1b80b00d9596bf5f.tar.gz otp-11dcd4774a6beb28306b9e6e1b80b00d9596bf5f.tar.bz2 otp-11dcd4774a6beb28306b9e6e1b80b00d9596bf5f.zip |
sys_core_fold: Remove uncovered clauses matching #c_map{}
sys_core_fold:eval_element/3 attempts to evaluate calls to element/2
at compile time or to warn when the call will obviously fail. For
example:
element(1, [a])
will obviously fail and eval_element/3 will produce a warning.
eval_element/3 uses the helper functions is_not_integer/1 and
is_not_tuple/1 to test whether the arguments are known to be
incorrect. The clauses that attempt to match #c_map{} in those
helper function will never be executed, because #c_map{} will
never occur directly in an argument for a function call.
For example, code such as:
element(1, #{a=>Val})
will be translated to:
let <NewVar> = #{a=>Val}
in element(1, NewVar)
since maps are not considered safe (some map operations may
cause an exception at run time).
Diffstat (limited to 'lib/compiler/src/cerl.erl')
0 files changed, 0 insertions, 0 deletions