Skip to content

Commit 9839bfa

Browse files
author
José Valim
committed
Deprecate previous partial application syntax
1 parent 0b640d9 commit 9839bfa

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

lib/elixir/lib/kernel/typespec.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ defmodule Kernel.Typespec do
216216
for modules being compiled.
217217
"""
218218
def defines_type?(module, name, arity) do
219-
finder = match?({ ^name, _, vars } when length(vars) == arity, &1)
219+
finder = &match?({ ^name, _, vars } when length(vars) == arity, &1)
220220
:lists.any(finder, Module.get_attribute(module, :type)) or
221221
:lists.any(finder, Module.get_attribute(module, :opaque))
222222
end

lib/elixir/src/elixir_partials.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ handle({ _, Meta, Args } = Original, S, Opt) when is_list(Args), S#elixir_scope.
1111
{ Call, Def, SC } when Def /= [] ->
1212
Final = validate(Meta, Def, SC),
1313
Block = setelement(3, Original, Call),
14+
elixir_errors:deprecation(Meta, S#elixir_scope.file, "partial application without capture is deprecated"),
1415
elixir_fn:fn(Meta, [{ Final, Meta, Block }], SC);
1516
_ -> error
1617
end;

lib/elixir/src/elixir_translator.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,9 @@ translate_each({ Atom, Meta, Args } = Original, S) when is_atom(Atom) ->
397397
elixir_dispatch:dispatch_import(Meta, Atom, Args, S, Callback);
398398
Else -> Else
399399
end;
400-
Else -> Else
400+
Else ->
401+
elixir_errors:deprecation(Meta, S#elixir_scope.file, "partial application without capture is deprecated"),
402+
Else
401403
end;
402404

403405
%% Remote calls
@@ -437,7 +439,9 @@ translate_each({ { '.', _, [Left, Right] }, Meta, Args } = Original, S) when is_
437439
end;
438440
Else -> Else
439441
end;
440-
Else -> Else
442+
Else ->
443+
elixir_errors:deprecation(Meta, S#elixir_scope.file, "partial application without capture is deprecated"),
444+
Else
441445
end;
442446

443447
%% Anonymous function calls

lib/mix/test/mix/deps_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule Mix.DepsTest do
4343

4444
in_fixture "deps_status", fn ->
4545
deps = Mix.Deps.all
46-
assert Enum.find deps, match?(Mix.Dep[app: :ok, status: { :ok, _ }], &1)
46+
assert Enum.find deps, &match?(Mix.Dep[app: :ok, status: { :ok, _ }], &1)
4747
end
4848
after
4949
Mix.Project.pop

0 commit comments

Comments
 (0)