Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/elixir/lib/kernel/parallel_compiler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ defmodule Kernel.ParallelCompiler do

{:waiting, kind, child, ref, on, defining} ->
# Oops, we already got it, do not put it on waiting.
# OR
# We're waiting on ourselves, send :found so that we can crash with a better error
waiting =
if :lists.any(&match?({^kind, ^on}, &1), result) do
if :lists.any(&match?({^kind, ^on}, &1), result) or on in defining do
send child, {ref, :found}
waiting
else
Expand Down
5 changes: 5 additions & 0 deletions lib/elixir/test/elixir/fixtures/parallel_struct/undef.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule Undef do
def undef do
%__MODULE__{}
end
end
7 changes: 7 additions & 0 deletions lib/elixir/test/elixir/kernel/parallel_compiler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ defmodule Kernel.ParallelCompilerTest do
end
end

test "emits struct undefined error when local struct is undefined" do
fixtures = [fixture_path("parallel_struct/undef.ex")]
assert capture_io(fn ->
assert catch_exit(Kernel.ParallelCompiler.files(fixtures)) == {:shutdown, 1}
end) =~ "Undef.__struct__/1 is undefined, cannot expand struct Undef"
end

test "does not hang on missing dependencies" do
fixtures = [fixture_path("parallel_compiler/bat.ex")]
assert capture_io(fn ->
Expand Down