aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/warnings_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-05-12 06:34:54 +0200
committerBjörn Gustavsson <[email protected]>2015-05-13 15:05:00 +0200
commitc758fa81e1c48c56ff20ef2a95e6424c1e69033a (patch)
tree6ba7b0fcc44fe4896a690ecaa18db72a9fe47169 /lib/compiler/test/warnings_SUITE.erl
parent6a3e878126da1e8d75c704510c7a7339ff306138 (diff)
downloadotp-c758fa81e1c48c56ff20ef2a95e6424c1e69033a.tar.gz
otp-c758fa81e1c48c56ff20ef2a95e6424c1e69033a.tar.bz2
otp-c758fa81e1c48c56ff20ef2a95e6424c1e69033a.zip
sys_core_fold: Eliminate warnings for unused terms
The optimization introduced in 0a0d39d351fc would cause spurious warnings of the type: "a term is constructed, but never used". To avoid the warning, we must mark not only tuples and lists as compiler_generated, but also each element. We must also propagate compiler_generated annotations in lets. For example, if we have: let <X -| ['compiler_generated']> = 42 in X + 1 we must propagate the compiler_generated annotation to the literal when do constant propagation: 42 -| ['compiler_generated'] + 1
Diffstat (limited to 'lib/compiler/test/warnings_SUITE.erl')
-rw-r--r--lib/compiler/test/warnings_SUITE.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl
index f6ba75577d..471ded219f 100644
--- a/lib/compiler/test/warnings_SUITE.erl
+++ b/lib/compiler/test/warnings_SUITE.erl
@@ -739,6 +739,14 @@ no_warnings(Config) when is_list(Config) ->
case R0 of
{r,V1,_V2,V3} -> {r,V1,\"def\",V3}
end.
+
+ d(In0, Bool) ->
+ {In1,Int} = case id(Bool) of
+ false -> {In0,0}
+ end,
+ [In1,Int].
+
+ id(I) -> I.
">>,
[],
[]}],