Skip to content

Commit f55b96e

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 2d75fda + 5ed9dda commit f55b96e

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/matchers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function matcher(term::Term)
8888
function term_matcher(success, data, bindings)
8989

9090
!islist(data) && return nothing
91-
!(istree(car(data))) && return nothing
91+
!istree(car(data)) && return nothing
9292

9393
function loop(term, bindings′, matchers′) # Get it to compile faster
9494
if !islist(matchers′)

src/rule.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ function makepattern(expr, keys)
6969
else
7070
:(term($(map(x->makepattern(x, keys), expr.args)...); type=Any))
7171
end
72+
elseif expr.head === :$
73+
return esc(expr.args[1])
7274
else
7375
error("Unsupported Expr of type $(expr.head) found in pattern")
7476
end

test/rulesets.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,12 @@ end
121121
expr1 = foldr((x,y)->rand([*, /])(x,y), rand([a,b,c,d], 100))
122122
SymbolicUtils.@timerewrite simplify(expr1)
123123
end
124+
125+
126+
@testset "interpolation" begin
127+
f(y) = sin
128+
@syms a
129+
130+
@test isnothing(@rule(f(1)(a) => 2)(sin(a)))
131+
@test @rule($(f(1))(a) => 2)(sin(a)) == 2
132+
end

0 commit comments

Comments
 (0)