Skip to content

Commit ccc24ea

Browse files
author
José Valim
committed
Avoid capture operator warnings
Signed-off-by: José Valim <[email protected]>
1 parent 65f1b2d commit ccc24ea

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

lib/elixir/src/elixir_erl_compiler.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ format_error(erl_lint, {undefined_function, {F, A}}) ->
8686
format_error(erl_lint, {spec_fun_undefined, {M, F, A}}) ->
8787
io_lib:format("spec for undefined function ~ts.~ts/~B", [elixir_aliases:inspect(M), F, A]);
8888

89+
%% Mention the capture operator in make_fun
90+
format_error(sys_core_fold, {no_effect, {erlang, make_fun, 3}}) ->
91+
"the result of the capture operator & (:erlang.make_fun/3) is never used";
92+
8993
%% Make no_effect clauses pretty
9094
format_error(sys_core_fold, {no_effect, {erlang, F, A}}) ->
9195
{Fmt, Args} = case erl_internal:comp_op(F, A) of

lib/elixir/test/elixir/kernel/lexical_tracker_test.exs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,21 @@ defmodule Kernel.LexicalTrackerTest do
234234
NotAModule
235235
Remote.func()
236236
R.func()
237-
&extract/2
238-
&is_record/1
239-
&R.func/0
240-
&Remote.func/0
241-
&Integer.is_even/1
237+
_ = &extract/2
238+
_ = &is_record/1
239+
_ = &R.func/0
240+
_ = &Remote.func/0
241+
_ = &Integer.is_even/1
242242
%Macro.Env{}
243243
end
244244
245-
&extract/2
246-
&is_record/1
247-
&R.func/0
248-
&Remote.func/0
249-
&Integer.is_even/1
245+
_ = &extract/2
246+
_ = &is_record/1
247+
_ = &R.func/0
248+
_ = &Remote.func/0
249+
_ = &Integer.is_even/1
250250
251-
&is_record/1; def b(a), do: is_record(a)
251+
_ = &is_record/1; def b(a), do: is_record(a)
252252
253253
%Macro.Env{}
254254

0 commit comments

Comments
 (0)