@@ -240,10 +240,37 @@ defmodule Mix.Tasks.Xref do
240240 Elixir tracks three types of dependencies between modules: compile,
241241 exports, and runtime. If a module has a compile time dependency on
242242 another module, the caller module has to be recompiled whenever the
243- callee changes. Compile-time dependencies are typically added when
244- using macros or when invoking functions in the module body (outside
245- of functions). You can list all dependencies in a file by running
246- `mix xref trace path/to/file.ex`.
243+ callee changes (or any runtime dependency of the callee changes).
244+ Let's see an example:
245+
246+ # lib/a.ex
247+ defmodule A do
248+ @hello B.hello()
249+ def hello, do: @hello
250+ end
251+
252+ # lib/b.ex
253+ defmodule B do
254+ def hello, do: "hello"
255+ def world, do: C.world()
256+ end
257+
258+ # lib/c.ex
259+ defmodule C do
260+ def world, do: "world"
261+ end
262+
263+ If `C.world/0` changes, `B` is marked as stale. `B` does not need to
264+ be recompiled, because it depends on `C` at runtime, but anything that
265+ depends on `B` at compile-time has to recompile, and that includes `A`.
266+
267+ Compile-time dependencies are typically added when using macros or
268+ when invoking functions in the module body (outside of functions).
269+ You can list all dependencies in a file by running
270+ `mix xref trace path/to/file.ex`. This type of transitive compile-time
271+ dependencies, such as `A` depending on `C` at compile-time through `B`,
272+ can be found with the "compile-connected" label, as in
273+ `mix xref graph --label compile-connected`.
247274
248275 Export dependencies are compile time dependencies on the module API,
249276 namely structs and its public definitions. For example, if you import
0 commit comments