Skip to content

Commit 81d04d8

Browse files
committed
Make sure we traverse all files when looking for definitions
1 parent ccb5546 commit 81d04d8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/elixir/lib/kernel/parallel_compiler.ex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ defmodule Kernel.ParallelCompiler do
398398
deadlocked =
399399
deadlocked(waiting, :soft, false) ||
400400
deadlocked(waiting, :soft, true) || deadlocked(waiting, :hard, false) ||
401-
without_definition(waiting)
401+
without_definition(waiting, files)
402402

403403
if deadlocked do
404404
spawn_workers(deadlocked, spawned, waiting, files, result, warnings, state)
@@ -457,9 +457,13 @@ defmodule Kernel.ParallelCompiler do
457457
defp each_cycle_return({kind, modules}), do: {kind, modules, []}
458458
defp each_cycle_return(modules) when is_list(modules), do: {:compile, modules, []}
459459

460-
defp without_definition(waiting) do
460+
# The goal of this function is to find leaves in the dependency graph,
461+
# i.e. to find code that depends on code that we know is not being defined.
462+
# Note that not all files have been compile yet, so they may not be in waiting.
463+
defp without_definition(waiting, files) do
461464
nillify_empty(
462-
for {_, _, ref, on, _, _} <- waiting,
465+
for %{pid: pid} <- files,
466+
{_, ^pid, ref, on, _, _} <- List.wrap(List.keyfind(waiting, pid, 1)),
463467
not defining?(on, waiting),
464468
do: {ref, :not_found}
465469
)

0 commit comments

Comments
 (0)