Skip to content

Commit 41b30b4

Browse files
committed
now rationals can be used in rules
1 parent 66e8253 commit 41b30b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/rule.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ function makepattern(expr, keys, parentCall=nothing)
130130
# matches ~x::predicate
131131
makeslot(expr.args[2], keys)
132132
end
133+
elseif expr.args[1] === :(//)
134+
# bc when the expression is not quoted, 3//2 is a Rational{Int64}, not a call
135+
return esc(expr.args[2] // expr.args[3])
133136
else
134137
# make a pattern for every argument of the expr.
135138
:(term($(map(x->makepattern(x, keys, operation(expr)), expr.args)...); type=Any))

0 commit comments

Comments
 (0)