diff options
author | Björn Gustavsson <[email protected]> | 2015-01-29 06:33:52 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-02-03 08:40:49 +0100 |
commit | 8c3baeb1275c2e6a316d3b5203e0598906785cdb (patch) | |
tree | 15315c8952ba753ab5e97097989e0e7f87e68f34 /lib/compiler/src/beam_dict.erl | |
parent | 8c0bebb66ba01b174e6482cd81949eaf08748bcd (diff) | |
download | otp-8c3baeb1275c2e6a316d3b5203e0598906785cdb.tar.gz otp-8c3baeb1275c2e6a316d3b5203e0598906785cdb.tar.bz2 otp-8c3baeb1275c2e6a316d3b5203e0598906785cdb.zip |
Suppress warnings for expressions that are assigned to '_'
In c34ad2d5, the compiler learned to silence some warnings for
expressions that were explicitly assigned to the '_' variable,
as in this example:
_ = list_to_integer(S),
ok
That commit intentionally only made it possible to silence warnings
for BIFs that could cause an exception. Warnings would still be
produced for:
_ = date(),
ok
because date/0 can never fail and thus making the call completely
useless. The reasoning was that such warnings can always be
eliminated by eliminating the offending code.
While that is true, there is the question about rules and their
consistency. It is surprising that '_' can be used to silence
some warnings, but has no effect on other warnings.
Therefore, we will teach the compiler to silence warnings for
the following constructs:
* Calls to safe BIFs such as date/0
* Expressions that will cause an exception such as 'X/0'
* Terms that are built but not used, such as '{x,X}'
Diffstat (limited to 'lib/compiler/src/beam_dict.erl')
0 files changed, 0 insertions, 0 deletions