Skip to content

Commit 5dd1f1b

Browse files
authored
Update lib/elixir/lib/kernel.ex
1 parent 62b722b commit 5dd1f1b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3727,15 +3727,19 @@ defmodule Kernel do
37273727
{_, doc} when doc_attr? ->
37283728
do_at_escape(name, doc)
37293729

3730-
%{__struct__: Regex, source: source, opts: opts} ->
3730+
%{__struct__: Regex, source: source, opts: opts} = regex ->
37313731
# TODO: Remove this in Elixir v2.0
37323732
IO.warn(
37333733
"storing and reading regexes from module attributes is deprecated, " <>
37343734
"inline the regex inside the function definition instead",
37353735
env
37363736
)
37373737

3738-
quote(do: Regex.compile!(unquote(source), unquote(opts)))
3738+
if :erlang.system_info(:otp_release) < [?2, ?8] do
3739+
do_at_escape(name, regex)
3740+
else
3741+
quote(do: Regex.compile!(unquote(source), unquote(opts)))
3742+
end
37393743

37403744
value ->
37413745
do_at_escape(name, value)

0 commit comments

Comments
 (0)