Narrow down `atomvm.packbeam` warning

I could track them both down with a lot of trial and error. Problem solved :slight_smile:

The issues were (in one of the deps):

  • Wrong use of Macro.escape instead of unquote
  • One module was using some Code.loaded?, Code.ensure_loaded?, :code.purge, and :code.delete. Removing that part removed the second warning too.

Regarding the first one:
The code looked like the following:

defmacro __using__(opts) do
  ...
  other = calc_something()
  ast = create_ast()
  quote bind_quoted: [other: other, ast: ast] do
    Macro.escape(ast)
    func(other)
    ...
  end
end

The tricky part is that removing the ast: ast from the bind_quoted and doing an explicit unquote(ast) didn’t work. Only by removing the whole bind_quoted did the trick, i.e. the following worked:

defmacro __using__(opts) do
  ...
  other = calc_something()
  ast = create_ast()
  quote do
    unquote(ast)
    func(unquote(other))
    ...
  end
end