Skip to content

Commit b813ac5

Browse files
YingboMashashi
andcommitted
Fix - printing
Co-authored-by: "Shashi Gowda" <[email protected]>
1 parent 97324e6 commit b813ac5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ function show_add(io, args)
370370
print_arg(io, -, t)
371371
else
372372
print(io, " - ")
373-
print_arg(io, +, -t)
373+
print_arg(IOContext(io, :paren=>true), +, -t)
374374
end
375375
end
376376
end

test/basics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ end
111111
@test repr(Term(*, [1, 1])) == "*1"
112112
@test repr(Term(*, [2, 1])) == "2*1"
113113
@test repr((a + b) - (b + c)) == "a - c"
114+
@test repr(a + -1*(b + c)) == "a - (b + c)"
115+
@test repr(a + -1*b) == "a - b"
114116
end
115117

116118
toterm(t) = Term{symtype(t)}(operation(t), arguments(t))

0 commit comments

Comments
 (0)