Skip to content

Commit 1508494

Browse files
committed
Remove assert_no_clauses check as we already handle ->
1 parent e29af5a commit 1508494

File tree

2 files changed

+0
-56
lines changed

2 files changed

+0
-56
lines changed

lib/elixir/src/elixir_expand.erl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -844,25 +844,8 @@ assert_no_ambiguous_op(Name, Meta, [Arg], S, E) ->
844844
assert_no_ambiguous_op(_Atom, _Meta, _Args, _S, _E) ->
845845
ok.
846846

847-
assert_no_clauses(_Name, _Meta, [], _E) ->
848-
ok;
849-
assert_no_clauses(Name, Meta, Args, E) ->
850-
assert_arg_with_no_clauses(Name, Meta, lists:last(Args), E).
851-
852-
assert_arg_with_no_clauses(Name, Meta, [{Key, Value} | Rest], E) when is_atom(Key) ->
853-
case Value of
854-
[{'->', _, _} | _] ->
855-
file_error(Meta, E, ?MODULE, {invalid_clauses, Name});
856-
_ ->
857-
assert_arg_with_no_clauses(Name, Meta, Rest, E)
858-
end;
859-
assert_arg_with_no_clauses(_Name, _Meta, _Arg, _E) ->
860-
ok.
861-
862847
expand_local(Meta, Name, Args, S, #{module := Module, function := Function, context := Context} = E)
863848
when Function /= nil ->
864-
assert_no_clauses(Name, Meta, Args, E),
865-
866849
%% In case we have the wrong context, we log a module error
867850
%% so we can print multiple entries at the same time.
868851
case Context of
@@ -887,8 +870,6 @@ expand_local(Meta, Name, Args, _S, #{function := nil} = E) ->
887870

888871
expand_remote(Receiver, DotMeta, Right, Meta, Args, S, SL, #{context := Context} = E)
889872
when is_atom(Receiver) or is_tuple(Receiver) ->
890-
assert_no_clauses(Right, Meta, Args, E),
891-
892873
if
893874
Context =:= guard, is_tuple(Receiver) ->
894875
(lists:keyfind(no_parens, 1, Meta) /= {no_parens, true}) andalso

lib/elixir/test/elixir/kernel/expansion_test.exs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,43 +2907,6 @@ defmodule Kernel.ExpansionTest do
29072907
assert_compile_error(~r"misplaced operator ->", fn ->
29082908
expand(quote(do: (foo -> bar)))
29092909
end)
2910-
2911-
message = ~r/"wrong_fun" cannot handle clauses with the ->/
2912-
2913-
assert_compile_error(message, fn ->
2914-
code =
2915-
quote do
2916-
wrong_fun do
2917-
_ -> :ok
2918-
end
2919-
end
2920-
2921-
expand(code)
2922-
end)
2923-
2924-
assert_compile_error(message, fn ->
2925-
code =
2926-
quote do
2927-
wrong_fun do
2928-
foo -> bar
2929-
after
2930-
:ok
2931-
end
2932-
end
2933-
2934-
expand(code)
2935-
end)
2936-
2937-
assert_compile_error(~r/"length" cannot handle clauses with the ->/, fn ->
2938-
code =
2939-
quote do
2940-
length do
2941-
_ -> :ok
2942-
end
2943-
end
2944-
2945-
expand(code)
2946-
end)
29472910
end
29482911

29492912
## Helpers

0 commit comments

Comments
 (0)