From 3bd3159432798ab07f781fdfa9626de7d06371f6 Mon Sep 17 00:00:00 2001 From: Shashi Gowda Date: Sun, 3 Oct 2021 20:50:49 -0400 Subject: [PATCH 1/2] fix method chosen when exprhead is not used --- src/TermInterface.jl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/TermInterface.jl b/src/TermInterface.jl index a1111f8..6f63e9c 100644 --- a/src/TermInterface.jl +++ b/src/TermInterface.jl @@ -110,7 +110,7 @@ end """ - similarterm(x, head, args, symtype=nothing; metadata=nothing, exprhead=exprhead(x)) + similarterm(x, head, args, symtype=nothing; metadata=nothing, exprhead=:call) Returns a term that is in the same closure of types as `typeof(x)`, with `head` as the head and `args` as the arguments, `type` as the symtype @@ -118,8 +118,13 @@ and `metadata` as the metadata. By default this will execute `head(args...)`. `x` parameter can also be a `Type`. The `exprhead` keyword argument is useful when manipulating `Expr`s. """ -similarterm(x, head, args, symtype=nothing; metadata=nothing, exprhead=exprhead(x)) = - similarterm(typeof(x), head, args, symtype; metadata=metadata, exprhead=exprhead) +function similarterm(x, head, args, symtype=nothing; metadata=nothing, exprhead=nothing) + if exprhead === nothing + similarterm(typeof(x), head, args, symtype; metadata=metadata) + else + similarterm(typeof(x), head, args, symtype; metadata=metadata, exprhead=exprhead) + end +end function similarterm(x::Type{T}, head, args, symtype=nothing; metadata=nothing, exprhead=:call) where T !istree(T) ? head : head(args...) From b9d56f7181e7bc404cf2f1946f47b3f50b636f83 Mon Sep 17 00:00:00 2001 From: Shashi Gowda Date: Sun, 3 Oct 2021 20:52:05 -0400 Subject: [PATCH 2/2] patch release --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 918638e..6745536 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TermInterface" uuid = "8ea1fca8-c5ef-4a55-8b96-4e9afe9c9a3c" authors = ["Shashi Gowda ", "Alessandro Cheli "] -version = "0.2.0" +version = "0.2.1" [compat] julia = "1"