Skip to content

Commit 4d56bdd

Browse files
lukaszsamsonjosevalim
authored andcommitted
Do not reset quote level on calls in has_unquotes/2
The bug was introduced in 146fb4e Signed-off-by: José Valim <jose.valim@gmail.com>
1 parent 2e9981d commit 4d56bdd

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/elixir/src/elixir_quote.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ end;
5555
has_unquotes({{'.', _, [_, unquote]}, _, [_]}, _) -> true;
5656
has_unquotes({Var, _, Ctx}, _) when is_atom(Var), is_atom(Ctx) -> false;
5757
has_unquotes({Name, _, Args}, QuoteLevel) when is_list(Args) ->
58-
has_unquotes(Name) orelse lists:any(fun(Child) -> has_unquotes(Child, QuoteLevel) end, Args);
58+
has_unquotes(Name, QuoteLevel) orelse lists:any(fun(Child) -> has_unquotes(Child, QuoteLevel) end, Args);
5959
has_unquotes({Left, Right}, QuoteLevel) ->
6060
has_unquotes(Left, QuoteLevel) orelse has_unquotes(Right, QuoteLevel);
6161
has_unquotes(List, QuoteLevel) when is_list(List) ->

lib/elixir/test/elixir/kernel/quote_test.exs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,15 @@ defmodule Kernel.QuoteTest.HasUnquoteTest do
739739

740740
refute :elixir_quote.has_unquotes(ast)
741741

742+
ast =
743+
quote unquote: false do
744+
quote do
745+
unquote(x)()
746+
end
747+
end
748+
749+
refute :elixir_quote.has_unquotes(ast)
750+
742751
ast =
743752
quote unquote: false do
744753
quote do

0 commit comments

Comments
 (0)