Skip to content

Commit 835aab4

Browse files
committed
Revert keyword argument T back to type in term to avoid breaking
[skip ci]
1 parent 497a717 commit 835aab4

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/methods.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ for (f, Domain) in [(==) => Number, (!=) => Number,
179179
xor => Bool]
180180
@eval begin
181181
promote_symtype(::$(typeof(f)), ::Type{<:$Domain}, ::Type{<:$Domain}) = Bool
182-
(::$(typeof(f)))(a::Symbolic{<:$Domain}, b::$Domain) = term($f, a, b; T = Bool)
183-
(::$(typeof(f)))(a::Symbolic{<:$Domain}, b::Symbolic{<:$Domain}) = term($f, a, b; T = Bool)
184-
(::$(typeof(f)))(a::$Domain, b::Symbolic{<:$Domain}) = term($f, a, b; T = Bool)
182+
(::$(typeof(f)))(a::Symbolic{<:$Domain}, b::$Domain) = term($f, a, b; type = Bool)
183+
(::$(typeof(f)))(a::Symbolic{<:$Domain}, b::Symbolic{<:$Domain}) = term($f, a, b; type = Bool)
184+
(::$(typeof(f)))(a::$Domain, b::Symbolic{<:$Domain}) = term($f, a, b; type = Bool)
185185
end
186186
end
187187

src/rule.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ function makepattern(expr, keys)
6767
makeslot(expr.args[2], keys)
6868
end
6969
else
70-
:(term($(map(x -> makepattern(x, keys), expr.args)...); T = Any))
70+
:(term($(map(x -> makepattern(x, keys), expr.args)...); type = Any))
7171
end
7272
elseif expr.head === :ref
73-
:(term(getindex, $(map(x -> makepattern(x, keys), expr.args)...); T = Any))
73+
:(term(getindex, $(map(x -> makepattern(x, keys), expr.args)...); type = Any))
7474
elseif expr.head === :$
7575
return esc(expr.args[1])
7676
else

src/types.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,11 @@ function makepow(a, b)
609609
base, exp
610610
end
611611

612-
function term(f, args...; T = nothing)
613-
if T === nothing
614-
T = _promote_symtype(f, args)
612+
function term(f, args...; type = nothing)
613+
if type === nothing
614+
type = _promote_symtype(f, args)
615615
end
616-
_Term(T, f, [args...])
616+
_Term(type, f, [args...])
617617
end
618618

619619
"""

test/basics.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct Ctx2 end
9191

9292

9393
@test isequal(substitute(1+sqrt(a), Dict(a => 2), fold=false),
94-
1 + term(sqrt, 2, T=Number))
94+
1 + term(sqrt, 2, type = Number))
9595
@test substitute(1+sqrt(a), Dict(a => 2), fold=true) isa Float64
9696
end
9797

@@ -173,7 +173,7 @@ end
173173
@syms a b c
174174
@test repr(a+b) == "a + b"
175175
@test repr(-a) == "-a"
176-
@test repr(term(-, a; T = Real)) == "-a"
176+
@test repr(term(-, a; type = Real)) == "-a"
177177
@test repr(-a + 3) == "3 - a"
178178
@test repr(-(a + b)) == "-a - b"
179179
@test repr((2a)^(-2a)) == "(2a)^(-2a)"
@@ -196,7 +196,7 @@ end
196196
@test repr(2a+1+3a^2+2b+3b^2+4a*b) == "1 + 2a + 2b + 3(a^2) + 4a*b + 3(b^2)"
197197

198198
@syms a b[1:3] c d[1:3]
199-
get(x, i) = term(getindex, x, i; T = Number)
199+
get(x, i) = term(getindex, x, i; type = Number)
200200
b1, b3, d1, d2 = get(b,1),get(b,3), get(d,1), get(d,2)
201201
@test repr(a + b3 + b1 + d2 + c) == "a + b[1] + b[3] + c + d[2]"
202202
@test repr(expand((c + b3 - d1)^3)) == "b[3]^3 + 3(b[3]^2)*c - 3(b[3]^2)*d[1] + 3b[3]*(c^2) - 6b[3]*c*d[1] + 3b[3]*(d[1]^2) + c^3 - 3(c^2)*d[1] + 3c*(d[1]^2) - (d[1]^3)"

test/rewrite.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ end
3838

3939
@eqtest @rule(+(~~x) => ~~x)(a + b) == [a,b]
4040
@eqtest @rule(+(~~x) => ~~x)(term(+, a, b, c)) == [a,b,c]
41-
@eqtest @rule(+(~~x, ~y, ~~x)=>(~~x, ~y))(term(+, 9, 8, 9; T = Any)) ==
41+
@eqtest @rule(+(~~x, ~y, ~~x)=>(~~x, ~y))(term(+, 9, 8, 9; type = Any)) ==
4242
(Symbolic[9], _Const(8))
43-
@eqtest @rule(+(~~x, ~y, ~~x)=>(~~x, ~y, ~~x))(term(+, 9, 8, 9, 9, 8; T = Any)) ==
43+
@eqtest @rule(+(~~x, ~y, ~~x)=>(~~x, ~y, ~~x))(term(+, 9, 8, 9, 9, 8; type = Any)) ==
4444
(Symbolic[9, 8], _Const(9), Symbolic[9, 8])
45-
@eqtest @rule(+(~~x, ~y, ~~x)=>(~~x, ~y, ~~x))(term(+, 6; T = Any)) ==
45+
@eqtest @rule(+(~~x, ~y, ~~x)=>(~~x, ~y, ~~x))(term(+, 6; type = Any)) ==
4646
(Symbolic[], _Const(6), Symbolic[])
4747
end
4848

0 commit comments

Comments
 (0)