An Elixir toolkit for the AT Protocol. hexdocs.pm/atex

Compile error on OTP 28: regex in @ref_value module attribute can't be escaped #3

Closed comet.sh
Closed opened by comet.sh

When using OTP 28 (and Elixir 1.18.4), lib/atex/lexicon/schema.ex fails to compile because @ref_value (line 99) holds a ~r/.../ regex.

  == Compilation error in file lib/atex/lexicon/schema.ex ==
  ** (ArgumentError) cannot inject attribute @ref_value into function/macro because cannot escape
  #Reference<0.3194275434.3268018188.220340>. The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
      (elixir 1.18.4) lib/kernel.ex:3777: Kernel.do_at_escape/2
      (elixir 1.18.4) expanding macro: Kernel.@/1
      lib/atex/lexicon/schema.ex:114: Atex.Lexicon.Schema.get_schema/1
  could not compile dependency :atex, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile atex --force", update it with "mix deps.update atex" or clean it with "mix deps.clean atex"

OTP/Elixir version (installed with nix):

Erlang/OTP 28 [erts-16.4] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Mix 1.18.4 (compiled with Erlang/OTP 28)

I have a fix for this that I'm using locally that replaces the @ref_value attribute with a ref_value private function instead, I'd be happy to PR it.

fixed by #4

Sign up or Sign in to add to the discussion.