Skip to content

Commit dafe2e6

Browse files
committed
Fix and test -(::Add)
1 parent 35a0bfa commit dafe2e6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/fast-terms.jl

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

9999
+(b::Add, a::Number) = iszero(a) ? b : Add(a + b.coeff, b.dict)
100100

101-
-(a::Add) = Add(-a.coeff, mapvalues(-, a.dict))
101+
-(a::Add) = Add(-a.coeff, mapvalues((_,v) -> -v, a.dict))
102102

103103
-(a::SN) = Add(makeadd(-1, 0, a)...)
104104

test/basics.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ end
9797
@test repr(a+b) == "a + b"
9898
@test repr(-a) == "-1a"
9999
@test repr(-a + 3) == "3 + -1a"
100+
@test repr(-(a + b)) == "-1a + -1b"
100101
end

0 commit comments

Comments
 (0)