Skip to content

Commit 17b9ba6

Browse files
committed
Do not crash parallel compiler on external reports, closes #13224
1 parent f83b4e4 commit 17b9ba6

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

lib/elixir/lib/kernel/parallel_compiler.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ defmodule Kernel.ParallelCompiler do
455455
# No more queue, nothing waiting, this cycle is done
456456
defp spawn_workers([], spawned, waiting, files, result, warnings, errors, state)
457457
when map_size(spawned) == 0 and map_size(waiting) == 0 do
458-
[] = errors
459458
[] = files
460459
cycle_return = each_cycle_return(state.each_cycle.())
461460
state = cycle_timing(result, state)

lib/elixir/test/elixir/kernel/parallel_compiler_test.exs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,28 @@ defmodule Kernel.ParallelCompilerTest do
196196
purge([QuickExample])
197197
end
198198

199+
test "does not crash on external reports" do
200+
[fixture] =
201+
write_tmp(
202+
"compile_quoted",
203+
quick_example: """
204+
defmodule CompileQuoted do
205+
try do
206+
Code.compile_quoted({:fn, [], [{:->, [], [[], quote(do: unknown_var)]}]})
207+
rescue
208+
_ -> :ok
209+
end
210+
end
211+
"""
212+
)
213+
214+
assert capture_io(:stderr, fn ->
215+
assert {:ok, [CompileQuoted], []} = Kernel.ParallelCompiler.compile([fixture])
216+
end) =~ "undefined variable \"unknown_var\""
217+
after
218+
purge([CompileQuoted])
219+
end
220+
199221
test "does not hang on missing dependencies" do
200222
[fixture] =
201223
write_tmp(

0 commit comments

Comments
 (0)