You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elixir 1.19.0-dev (8b79681) (compiled with Erlang/OTP 27)
Operating system
MacOS
Current behavior
✅ When a regex is stored in a module attribute and used in a function body, a warning it emitted.
❌ When it's stored in a list, map, or anything, nothing is being emitted.
defmoduleFoodo@regex~r/hello/@list_regex[~r/hello/,~r/world/]defusedoRegex.match?(@regex,"use")Enum.any?(@list_regex,&Regex.match?(&1,"use"))endend# only the first @ emitswarning: storingandreadingregexesfrommoduleattributesisdeprecated,inlinetheregexinsidethefunctiondefinitioninstead
└─ iex:6: Foo.use/0
Expected behavior
I would have expected all regexes placed in module attributes to emit a warning, as, as far as I understand, those in arrays will cause an issue in OTP 28 too.
I see the warning is emitted when the module attribute is used, which may explain why it does not occur for lists or maps of regexes. Should it be moved to the module attribute declaration?
The text was updated successfully, but these errors were encountered:
The warning is emitted so we have fewer crashes but we may not be able to get rid of all of them. I will see if there is something that can be done about lists but there may still be other cases.
Yeah I know I've been using lists of tuples with regexes, and maybe maps are a thing too.
But if we really want to address this, should we do it in :elixir_quote.escape with a new :module_attr kind or sth?
Good call, I think :elixir_quote is the way to go indeed, I went ahead and improved the error message there, with the initial going of surfacing those incompatibilities so we can assess how common the idiom is.
Uh oh!
There was an error while loading. Please reload this page.
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.2.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.19.0-dev (8b79681) (compiled with Erlang/OTP 27)
Operating system
MacOS
Current behavior
✅ When a regex is stored in a module attribute and used in a function body, a warning it emitted.
❌ When it's stored in a list, map, or anything, nothing is being emitted.
Expected behavior
I would have expected all regexes placed in module attributes to emit a warning, as, as far as I understand, those in arrays will cause an issue in OTP 28 too.
I see the warning is emitted when the module attribute is used, which may explain why it does not occur for lists or maps of regexes. Should it be moved to the module attribute declaration?
The text was updated successfully, but these errors were encountered: