aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/sys_core_fold.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-01-30 15:34:47 +0100
committerBjörn Gustavsson <[email protected]>2014-01-30 15:44:27 +0100
commit4aeef6279f19a15c728befe817d78d669bb5d1fd (patch)
treed9046d545bc2a62e0cf523e7a64f5860a2387029 /lib/compiler/src/sys_core_fold.erl
parentfdcdaca338849d7f63d4300e489318f6ee275d82 (diff)
downloadotp-4aeef6279f19a15c728befe817d78d669bb5d1fd.tar.gz
otp-4aeef6279f19a15c728befe817d78d669bb5d1fd.tar.bz2
otp-4aeef6279f19a15c728befe817d78d669bb5d1fd.zip
Issue a warning when a named fun is constructed but not used
Diffstat (limited to 'lib/compiler/src/sys_core_fold.erl')
-rw-r--r--lib/compiler/src/sys_core_fold.erl4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index 1cdbac5693..40f324b839 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -305,6 +305,10 @@ expr(#c_let{}=Let, Ctxt, Sub) ->
%% Now recursively re-process the new expression.
expr(Expr, Ctxt, sub_new_preserve_types(Sub))
end;
+expr(#c_letrec{body=#c_var{}}=Letrec, effect, _Sub) ->
+ %% This is named fun in an 'effect' context. Warn and ignore.
+ add_warning(Letrec, useless_building),
+ void();
expr(#c_letrec{defs=Fs0,body=B0}=Letrec, Ctxt, Sub) ->
Fs1 = map(fun ({Name,Fb}) ->
{Name,expr(Fb, {letrec,Ctxt}, Sub)}