Skip to content

Commit 747ba5c

Browse files
authored
Merge pull request #517 from JuliaSymbolics/myb/pp
Fix -x printing
2 parents ba96757 + cb1351d commit 747ba5c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ end
778778

779779
function show_call(io, f, args)
780780
fname = istree(f) ? Symbol(repr(f)) : nameof(f)
781-
binary = Base.isbinaryoperator(fname)
781+
binary = Base.isbinaryoperator(fname) && length(args) > 1
782782
if binary
783783
for (i, t) in enumerate(args)
784784
i != 1 && print(io, " $fname ")

test/basics.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operation, arguments, issym, isterm, BasicSymbolic
1+
using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operation, arguments, issym, isterm, BasicSymbolic, term
22
using SymbolicUtils
33
using IfElse: ifelse
44
using Setfield
@@ -173,6 +173,7 @@ end
173173
@syms a b c
174174
@test repr(a+b) == "a + b"
175175
@test repr(-a) == "-a"
176+
@test repr(term(-, a; type = Real)) == "-(a)"
176177
@test repr(-a + 3) == "3 - a"
177178
@test repr(-(a + b)) == "-a - b"
178179
@test repr((2a)^(-2a)) == "(2a)^(-2a)"

0 commit comments

Comments
 (0)