Skip to content

Commit

Permalink
Fix -x printing
Browse files Browse the repository at this point in the history
  • Loading branch information
YingboMa committed Mar 17, 2023
1 parent ba96757 commit cb1351d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ end

function show_call(io, f, args)
fname = istree(f) ? Symbol(repr(f)) : nameof(f)
binary = Base.isbinaryoperator(fname)
binary = Base.isbinaryoperator(fname) && length(args) > 1
if binary
for (i, t) in enumerate(args)
i != 1 && print(io, " $fname ")
Expand Down
3 changes: 2 additions & 1 deletion test/basics.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operation, arguments, issym, isterm, BasicSymbolic
using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operation, arguments, issym, isterm, BasicSymbolic, term
using SymbolicUtils
using IfElse: ifelse
using Setfield
Expand Down Expand Up @@ -173,6 +173,7 @@ end
@syms a b c
@test repr(a+b) == "a + b"
@test repr(-a) == "-a"
@test repr(term(-, a; type = Real)) == "-(a)"
@test repr(-a + 3) == "3 - a"
@test repr(-(a + b)) == "-a - b"
@test repr((2a)^(-2a)) == "(2a)^(-2a)"
Expand Down

0 comments on commit cb1351d

Please sign in to comment.