Skip to content

Commit f0595a4

Browse files
committed
Fix docs for Macro.compile_apply/4
1 parent c7a54ae commit f0595a4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/elixir/lib/macro.ex

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,12 +1765,17 @@ defmodule Macro do
17651765
@doc """
17661766
Applies a `mod`, `function`, and `args` at compile-time in `caller`.
17671767
1768-
This is used when you want to programmatically invoke a macro at
1769-
compile-time.
1768+
This is used when you want to dynamically invoke a function at
1769+
compile-time and force it to be tracked as a compile-time dependency.
1770+
For example, this is used by `dbg/1` to force the `dbg_callback`
1771+
configuration to be a compile-time dependency.
1772+
1773+
If you want to "invoke" a macro instead, remember macros are by
1774+
definition compile-time, and you can use `Macro.expand/2`.
17701775
"""
17711776
@doc since: "1.16.0"
17721777
def compile_apply(mod, fun, args, caller) do
1773-
:elixir_env.trace({:remote_macro, [], mod, fun, length(args)}, caller)
1778+
:elixir_env.trace({:remote_function, [], mod, fun, length(args)}, %{caller | function: nil})
17741779
Kernel.apply(mod, fun, args)
17751780
end
17761781

0 commit comments

Comments
 (0)