Skip to content

Commit db219bc

Browse files
committed
Properly handle Macro inputs and output types in expansion
Closes #12299 Closes #12324
1 parent fbe70c4 commit db219bc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/elixir/lib/macro.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,7 +1768,7 @@ defmodule Macro do
17681768
end
17691769
17701770
"""
1771-
@spec expand_once(t(), Macro.Env.t()) :: t()
1771+
@spec expand_once(input(), Macro.Env.t()) :: output()
17721772
def expand_once(ast, env) do
17731773
elem(do_expand_once(ast, env), 0)
17741774
end
@@ -2030,7 +2030,7 @@ defmodule Macro do
20302030
when they change.
20312031
"""
20322032
@doc since: "1.14.1"
2033-
@spec expand_literals(t(), Macro.Env.t()) :: t()
2033+
@spec expand_literals(input(), Macro.Env.t()) :: output()
20342034
def expand_literals(ast, env) do
20352035
{ast, :ok} = expand_literals(ast, :ok, fn node, :ok -> {expand(node, env), :ok} end)
20362036
ast
@@ -2110,7 +2110,7 @@ defmodule Macro do
21102110
This function uses `expand_once/2` under the hood. Check
21112111
it out for more information and examples.
21122112
"""
2113-
@spec expand(t(), Macro.Env.t()) :: t()
2113+
@spec expand(input(), Macro.Env.t()) :: output()
21142114
def expand(ast, env) do
21152115
expand_until({ast, true}, env)
21162116
end

lib/elixir/test/elixir/macro_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ defmodule MacroTest do
172172
end
173173

174174
test "env" do
175-
env = %{__ENV__ | line: 0}
175+
env = %{__ENV__ | line: 0, lexical_tracker: self()}
176176

177177
expanded = Macro.expand_once(quote(do: __ENV__), env)
178178
assert Macro.validate(expanded) == :ok

0 commit comments

Comments
 (0)