Skip to content

Commit fb4ccfa

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

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
@@ -1763,7 +1763,7 @@ defmodule Macro do
17631763
end
17641764
17651765
"""
1766-
@spec expand_once(t(), Macro.Env.t()) :: t()
1766+
@spec expand_once(input(), Macro.Env.t()) :: output()
17671767
def expand_once(ast, env) do
17681768
elem(do_expand_once(ast, env), 0)
17691769
end
@@ -2000,7 +2000,7 @@ defmodule Macro do
20002000
when they change.
20012001
"""
20022002
@doc since: "1.14.1"
2003-
@spec expand_literals(t(), Macro.Env.t()) :: t()
2003+
@spec expand_literals(input(), Macro.Env.t()) :: output()
20042004
def expand_literals(ast, env) do
20052005
{ast, :ok} = expand_literals(ast, :ok, fn node, :ok -> {expand(node, env), :ok} end)
20062006
ast
@@ -2080,7 +2080,7 @@ defmodule Macro do
20802080
This function uses `expand_once/2` under the hood. Check
20812081
it out for more information and examples.
20822082
"""
2083-
@spec expand(t(), Macro.Env.t()) :: t()
2083+
@spec expand(input(), Macro.Env.t()) :: output()
20842084
def expand(ast, env) do
20852085
expand_until({ast, true}, env)
20862086
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)