aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/warnings_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-02-12 09:22:35 +0100
committerBjörn Gustavsson <[email protected]>2015-03-09 09:59:36 +0100
commit86fbd6d76d342906e2a77df877013ea68de73cfb (patch)
tree6270a866bd2571cf35dc082140549efe1d659567 /lib/compiler/test/warnings_SUITE.erl
parent317067dc20574f76a0cdbd8a57567938fd484e39 (diff)
downloadotp-86fbd6d76d342906e2a77df877013ea68de73cfb.tar.gz
otp-86fbd6d76d342906e2a77df877013ea68de73cfb.tar.bz2
otp-86fbd6d76d342906e2a77df877013ea68de73cfb.zip
sys_core_fold: Strengthen type optimization in lets
Make sure that we take extract all possible type information when optimizing a 'let' construct. Since the stronger optimization may generate false warnings, we also need to take special care to suppress false warnings.
Diffstat (limited to 'lib/compiler/test/warnings_SUITE.erl')
-rw-r--r--lib/compiler/test/warnings_SUITE.erl26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl
index dcd3910926..d0b7c71be8 100644
--- a/lib/compiler/test/warnings_SUITE.erl
+++ b/lib/compiler/test/warnings_SUITE.erl
@@ -39,7 +39,7 @@
guard/1,bad_arith/1,bool_cases/1,bad_apply/1,
files/1,effect/1,bin_opt_info/1,bin_construction/1,
comprehensions/1,maps/1,redundant_boolean_clauses/1,
- latin1_fallback/1,underscore/1]).
+ latin1_fallback/1,underscore/1,no_warnings/1]).
% Default timetrap timeout (set in init_per_testcase).
-define(default_timeout, ?t:minutes(2)).
@@ -65,7 +65,7 @@ groups() ->
bad_arith,bool_cases,bad_apply,files,effect,
bin_opt_info,bin_construction,comprehensions,maps,
redundant_boolean_clauses,latin1_fallback,
- underscore]}].
+ underscore,no_warnings]}].
init_per_suite(Config) ->
Config.
@@ -281,7 +281,6 @@ bad_arith(Config) when is_list(Config) ->
{3,sys_core_fold,{eval_failure,badarith}},
{9,sys_core_fold,nomatch_guard},
{9,sys_core_fold,{eval_failure,badarith}},
- {9,sys_core_fold,{no_effect,{erlang,is_integer,1}}},
{10,sys_core_fold,nomatch_guard},
{10,sys_core_fold,{eval_failure,badarith}},
{15,sys_core_fold,{eval_failure,badarith}}
@@ -719,6 +718,27 @@ underscore(Config) when is_list(Config) ->
ok.
+no_warnings(Config) when is_list(Config) ->
+ Ts = [{no_warnings,
+ <<"-record(r, {s=ordsets:new(),a,b}).
+
+ a() ->
+ R = #r{}, %No warning expected.
+ {R#r.a,R#r.b}.
+
+ b(X) ->
+ T = true,
+ Var = [X], %No warning expected.
+ case T of
+ false -> Var;
+ true -> []
+ end.
+ ">>,
+ [],
+ []}],
+ run(Config, Ts),
+ ok.
+
%%%
%%% End of test cases.
%%%