From b77b07bcc92eaf47e278300be5f682454430a7fd Mon Sep 17 00:00:00 2001 From: Shashi Gowda Date: Mon, 27 May 2024 23:13:25 -0400 Subject: [PATCH] Add deprecation warnings --- src/SymbolicUtils.jl | 1 + src/types.jl | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/SymbolicUtils.jl b/src/SymbolicUtils.jl index 00b0c499d..d748f46c6 100644 --- a/src/SymbolicUtils.jl +++ b/src/SymbolicUtils.jl @@ -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 diff --git a/src/types.jl b/src/types.jl index 6f35f2777..a1799cebb 100644 --- a/src/types.jl +++ b/src/types.jl @@ -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 @@ -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 ###