Skip to content

Commit 7a0217a

Browse files
committed
Merge branch 'isabell/compiler/fix/GH-11472/OTP-20304' into maint
* isabell/compiler/fix/GH-11472/OTP-20304: compiler: Suppress incorrect `useless_building` warning
2 parents 73d1ce4 + e39e930 commit 7a0217a

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

lib/compiler/src/sys_core_fold.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2901,7 +2901,7 @@ void() -> #c_literal{val=ok}.
29012901
descend(_Core, #sub{top=false}=Sub) ->
29022902
Sub;
29032903
descend(Core, #sub{top=true}=Sub) ->
2904-
case should_suppress_warning(Core) of
2904+
case is_compiler_generated(Core) of
29052905
true ->
29062906
%% In a list comprehension being ignored such as:
29072907
%%

lib/compiler/test/warnings_SUITE.erl

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
underscore/1,no_warnings/1,
4848
bit_syntax/1,inlining/1,tuple_calls/1,
4949
recv_opt_info/1,opportunistic_warnings/1,
50-
eep49/1,inline_list_funcs/1]).
50+
eep49/1,inline_list_funcs/1,gh_11472/1]).
5151

5252
init_per_testcase(_Case, Config) ->
5353
Config.
@@ -71,7 +71,7 @@ groups() ->
7171
redundant_boolean_clauses,
7272
underscore,no_warnings,bit_syntax,inlining,
7373
tuple_calls,recv_opt_info,opportunistic_warnings,
74-
eep49,inline_list_funcs]}].
74+
eep49,inline_list_funcs,gh_11472]}].
7575

7676
init_per_suite(Config) ->
7777
test_lib:recompile(?MODULE),
@@ -1363,6 +1363,25 @@ inline_list_funcs(Config) ->
13631363

13641364
ok.
13651365

1366+
gh_11472(Config) ->
1367+
Ts = [{nowarn,
1368+
<<"-export([f/1]).
1369+
f(Acc) ->
1370+
X = 0,
1371+
{Y} =
1372+
begin
1373+
_Fresh1 = {[X | Acc]},
1374+
_Fresh1
1375+
end,
1376+
Y.
1377+
">>,
1378+
[],
1379+
[]}
1380+
],
1381+
[] = run(Config,Ts),
1382+
1383+
ok.
1384+
13661385

13671386
%%%
13681387
%%% End of test cases.

0 commit comments

Comments
 (0)