Skip to content

Commit f43dbdb

Browse files
author
Shashi Gowda
committed
default issym -- also make it work on types for consistency
1 parent def31aa commit f43dbdb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/TermInterface.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export symtype
3030
Returns `true` if `x` is a symbol. If true, `nameof` must be defined
3131
on `x` and must return a Symbol.
3232
"""
33-
function issym end
33+
issym(x) = issym(typeof(x))
34+
issym(x::Type{T}) where {T} = false
3435
export issym
3536

3637
"""
@@ -96,7 +97,7 @@ similarterm(x, head, args, symtype=nothing; metadata=nothing) =
9697
similarterm(x::Type{Expr}, head, args, symtype=nothing; metadata=nothing) = Expr(head, args...)
9798

9899
function similarterm(x::Type{T}, head, args, symtype=nothing; metadata=nothing) where T
99-
if !istree(T) head else head(args...) end
100+
!istree(T) ? head : head(args...)
100101
end
101102
export similarterm
102103

0 commit comments

Comments
 (0)