@@ -6562,7 +6562,13 @@ end
6562
6562
Base. @_inline_meta
6563
6563
prev = getfield (x, i)
6564
6564
next = getfield (y, i)
6565
- recursive_add (prev, next, f, forcelhs)
6565
+ ST = Core. Typeof (prev)
6566
+ if ! mutable_register (ST)
6567
+ recursive_add (prev, next, f, forcelhs)
6568
+ elseif ! (ST <: Integer )
6569
+ recursive_accumulate (prev, next, f)
6570
+ prev
6571
+ end
6566
6572
end )
6567
6573
end
6568
6574
@@ -6591,18 +6597,19 @@ end
6591
6597
6592
6598
# Recursively In-place accumulate(aka +=). E.g. generalization of x .+= f(y)
6593
6599
@inline function recursive_accumulate (x:: Array{T} , y:: Array{T} , f:: F = identity) where {T, F}
6594
- if ! mutable_register (T)
6595
- for I in eachindex (x)
6596
- prev = x[I]
6600
+ for I in eachindex (x, y)
6601
+ if ! mutable_register (T)
6597
6602
@inbounds x[I] = recursive_add (x[I], (@inbounds y[I]), f, mutable_register)
6603
+ elseif ! (T <: Integer )
6604
+ recursive_accumulate ((@inbounds x[I]), (@inbounds y[I]), f)
6598
6605
end
6599
6606
end
6600
6607
end
6601
6608
6602
6609
6603
6610
# Recursively In-place accumulate(aka +=). E.g. generalization of x .+= f(y)
6604
6611
@inline function recursive_accumulate (x:: Core.Box , y:: Core.Box , f:: F = identity) where {F}
6605
- recursive_accumulate (x. contents, y. contents, seen, f)
6612
+ recursive_accumulate (x. contents, y. contents, f)
6606
6613
end
6607
6614
6608
6615
@inline function recursive_accumulate (x:: T , y:: T , f:: F = identity) where {T, F}
@@ -6613,12 +6620,14 @@ end
6613
6620
for i in 1 : nf
6614
6621
if isdefined (x, i)
6615
6622
xi = getfield (x, i)
6623
+ yi = getfield (y, i)
6616
6624
ST = Core. Typeof (xi)
6617
6625
if ! mutable_register (ST)
6618
6626
@assert ismutable (x)
6619
- yi = getfield (y, i)
6620
6627
nexti = recursive_add (xi, yi, f, mutable_register)
6621
6628
setfield! (x, i, nexti)
6629
+ elseif ! (ST <: Integer )
6630
+ recursive_accumulate (xi, yi, f)
6622
6631
end
6623
6632
end
6624
6633
end
0 commit comments