Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code.compile_quoted/2 leaves errors in parallel compiler accumulator #13224

Closed
am-kantox opened this issue Jan 4, 2024 · 0 comments
Closed

Comments

@am-kantox
Copy link
Contributor

Elixir and Erlang/OTP versions

❯ iex
Erlang/OTP 26 [erts-14.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.16.0) - press Ctrl+C to exit (type h() ENTER for help)

Operating system

Linux 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Current behavior

① Create the new project with mix new diagnostics_compiler_test.
② Change the code of the only module to be

defmodule DiagnosticsCompilerTest do
  Code.with_diagnostics(fn ->
    try do
      {:ok, Code.compile_quoted({:fn, [], [{:->, [], [[], quote(do: unknown_var)]}]})}
    rescue
      err -> {:error, err}
    end
  end)
end

③ Run mix compile.


The result would be a compile error provoked [AFAICT] by Code.compile_quoted/2 leaving the error in the spawn_workers/8 accumulator errors.

❯ mix compile
Compiling 1 file (.ex)
** (EXIT from #PID<0.99.0>) an exception was raised:
    ** (MatchError) no match of right hand side value: [%{message: "undefined variable \"unknown_var\" (context DiagnosticsCompilerTest)", position: 0, file: "/home/aleksei/Proyectos/Elixir/diagnostics_compiler_test/nofile", stacktrace: [], source: "nofile", span: nil, severity: :error}]
        (elixir 1.16.0) lib/kernel/parallel_compiler.ex:458: Kernel.ParallelCompiler.spawn_workers/8
        (elixir 1.16.0) lib/kernel/parallel_compiler.ex:291: Kernel.ParallelCompiler.spawn_workers/5
        (elixir 1.16.0) lib/kernel/parallel_compiler.ex:246: Kernel.ParallelCompiler.spawn_workers/3
        (mix 1.16.0) lib/mix/compilers/elixir.ex:1002: anonymous fn/9 in Mix.Compilers.Elixir.compiler_loop/6

Expected behavior

Compilation succeeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant