Skip to content

Commit a3f4d0a

Browse files
committed
Fix module attribute with empty list in Macro.to_string, closes #12097
1 parent 391c3a9 commit a3f4d0a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/elixir/lib/code/normalizer.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ defmodule Code.Normalizer do
201201
defp do_normalize({:@, meta, [{name, name_meta, [value]}]}, state) do
202202
value =
203203
cond do
204-
keyword?(value) ->
204+
keyword?(value) and value != [] ->
205205
normalize_kw_args(value, state, true)
206206

207207
is_list(value) ->

lib/elixir/test/elixir/code_normalizer/quoted_ast_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ defmodule Code.Normalizer.QuotedASTTest do
544544
end
545545

546546
test "list in module attribute" do
547+
assert quoted_to_string(
548+
quote do
549+
@foo []
550+
end
551+
) == "@foo []"
552+
547553
assert quoted_to_string(
548554
quote do
549555
@foo [1]

0 commit comments

Comments
 (0)