Macro Expansion/Compilation rules changed in Elixir 1.20?

Hello, I’ve found an interesting non-backwards-compatible change in Elixir 1.20.

For context: There exists a project called PolyHok, which is a DSL that is embedded in Elixir, its aim is to make GPU programming easier in Elixir, I am one of the people participating in the development of this DSL.

The main way you’re supposed to use it is by using the PolyHok.defmodule macro, which basically overloads the defmodule construct, it processes the defk (define kernel) and defd (define device function) expressions, takes them out of the module body, then process that module normally. Now, I know that that’s not the most orthodox way to do it, as Nx doesn’t do it like that, but it worked in previous versions. Here’s an example:

require PolyHok

PolyHok.defmodule Wow do
  defk myk(a) do
    a[1] = 9.2
  end

  def f() do
    2
  end
end

In Elixir 1.19.6, it functions normally and you can use the defk definition for whatever you wanna use it for, but for Elixir 1.20 and later, it spits out this error:

    error: undefined function defk/2 (there is no such import)
    │
  4 │   defk myk(a) do
    │   ^
    │
    └─ elixir/examples.exs:4:3: Wow (module)

** (CompileError) elixir/examples.exs: cannot compile module Wow (errors have been logged)

Does anyone why this happens, why the behavior was changed, and if there is an easy way to fix this?

Links for the curious:
PolyHok website: PolyHok: GPGPU in Elixir []
PolyHok repository: GitHub - lups-ufpel/poly_hok: PolyHok DSL repository. · GitHub

The release note for 1.20 does contain the following. Not sure this helps you:

[Kernel] Show undefined function errors even when missing variables (this helps debug errors caused when the developer forgets to require a macro)