Skip to content

Commit cda830f

Browse files
authored
Merge pull request #513 from JuliaSymbolics/b/fix-unary-binary-operator-printing
Fix printing for term operators that could be both unary and binary
2 parents 9f5298c + 662acb5 commit cda830f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/types.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,11 @@ end
780780

781781
function show_call(io, f, args)
782782
fname = istree(f) ? Symbol(repr(f)) : nameof(f)
783-
binary = Base.isbinaryoperator(fname) && length(args) > 1
784-
if binary
783+
len_args = length(args)
784+
if Base.isunaryoperator(fname) && len_args == 1
785+
print(io, "$fname")
786+
print_arg(io, first(args), paren=true)
787+
elseif Base.isbinaryoperator(fname) && len_args > 1
785788
for (i, t) in enumerate(args)
786789
i != 1 && print(io, " $fname ")
787790
print_arg(io, t, paren=true)

0 commit comments

Comments
 (0)