Skip to content

Commit b77b07b

Browse files
committed
Add deprecation warnings
1 parent 99c6757 commit b77b07b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/SymbolicUtils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import TermInterface: iscall, isexpr, issym, symtype, head, children,
2020
operation, arguments, metadata, maketerm
2121

2222
const istree = iscall
23+
Base.@deprecate_binding istree iscall
2324
export istree, operation, arguments, unsorted_arguments, similarterm, iscall
2425
# Sym, Term,
2526
# Add, Mul and Pow

src/types.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ end
536536
unflatten(t) = t
537537

538538
function TermInterface.maketerm(::Type{<:BasicSymbolic}, head, args, type, metadata)
539-
basicsymbolic(first(args), args[2:end], type, metadata)
539+
basicsymbolic(head, args, type, metadata)
540540
end
541541

542542

@@ -640,24 +640,23 @@ end
640640
641641
"""
642642
function similarterm(x, op, args, symtype=nothing; metadata=nothing)
643-
TermInterface.maketerm(typeof(x), callhead(x), [op, args...], symtype, metadata)
643+
Base.depwarn("""`similarterm` is deprecated, use `maketerm` instead.
644+
`similarterm(x, op, args, symtype; metadata)` is now
645+
`maketerm(typeof(x), op, args, symtype, metadata)`""", :similarterm)
646+
TermInterface.maketerm(typeof(x), op, args, symtype, metadata)
644647
end
645648

646649
# Old fallback
647650
function similarterm(T::Type, op, args, symtype=nothing; metadata=nothing)
651+
652+
Base.depwarn("`similarterm` is deprecated, use `maketerm` instead." *
653+
"See https://github.com/JuliaSymbolics/TermInterface.jl for details.", :similarterm)
648654
op(args...)
649655
end
650656

651657
export similarterm
652658

653659

654-
"""
655-
callhead(x)
656-
Used in this deprecation cycle of `similarterm` to find the `head` argument to
657-
`maketerm`. Do not implement this, or use `similarterm` if you're using this package.
658-
"""
659-
callhead(x) = typeof(x)
660-
661660
###
662661
### Pretty printing
663662
###

0 commit comments

Comments
 (0)