Skip to content

Commit a8eab99

Browse files
author
José Valim
committed
Make explicit is_range / is_regex are allowed in guards
1 parent b6d97c3 commit a8eab99

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
@@ -1769,19 +1769,23 @@ defmodule Kernel do
17691769

17701770
@doc """
17711771
Checks if the given argument is a regex.
1772+
1773+
Works in guard clauses.
17721774
"""
17731775
defmacro is_regex(thing) do
17741776
quote do
1775-
is_record(unquote(thing), Regex)
1777+
Kernel.is_record(unquote(thing), Regex)
17761778
end
17771779
end
17781780

17791781
@doc """
17801782
Checks if the given argument is a range.
1783+
1784+
Works in guard clauses.
17811785
"""
17821786
defmacro is_range(thing) do
17831787
quote do
1784-
is_record(unquote(thing), Range)
1788+
Kernel.is_record(unquote(thing), Range)
17851789
end
17861790
end
17871791

0 commit comments

Comments
 (0)