Skip to content

Commit

Permalink
Merge pull request #517 from JuliaSymbolics/myb/pp
Browse files Browse the repository at this point in the history
Fix -x printing
  • Loading branch information
YingboMa authored Mar 17, 2023
2 parents ba96757 + cb1351d commit 747ba5c
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 747ba5c

Please sign in to comment.