Skip to content

Commit

Permalink
Add deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shashi committed May 28, 2024
1 parent 99c6757 commit b77b07b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/SymbolicUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import TermInterface: iscall, isexpr, issym, symtype, head, children,
operation, arguments, metadata, maketerm

const istree = iscall
Base.@deprecate_binding istree iscall
export istree, operation, arguments, unsorted_arguments, similarterm, iscall
# Sym, Term,
# Add, Mul and Pow
Expand Down
17 changes: 8 additions & 9 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ end
unflatten(t) = t

function TermInterface.maketerm(::Type{<:BasicSymbolic}, head, args, type, metadata)
basicsymbolic(first(args), args[2:end], type, metadata)
basicsymbolic(head, args, type, metadata)
end


Expand Down Expand Up @@ -640,24 +640,23 @@ end
"""
function similarterm(x, op, args, symtype=nothing; metadata=nothing)
TermInterface.maketerm(typeof(x), callhead(x), [op, args...], symtype, metadata)
Base.depwarn("""`similarterm` is deprecated, use `maketerm` instead.
`similarterm(x, op, args, symtype; metadata)` is now
`maketerm(typeof(x), op, args, symtype, metadata)`""", :similarterm)
TermInterface.maketerm(typeof(x), op, args, symtype, metadata)
end

# Old fallback
function similarterm(T::Type, op, args, symtype=nothing; metadata=nothing)

Base.depwarn("`similarterm` is deprecated, use `maketerm` instead." *
"See https://github.com/JuliaSymbolics/TermInterface.jl for details.", :similarterm)
op(args...)
end

export similarterm


"""
callhead(x)
Used in this deprecation cycle of `similarterm` to find the `head` argument to
`maketerm`. Do not implement this, or use `similarterm` if you're using this package.
"""
callhead(x) = typeof(x)

###
### Pretty printing
###
Expand Down

0 comments on commit b77b07b

Please sign in to comment.