diff --git a/src/collect.jl b/src/collect.jl index 21979895..c2e898ea 100644 --- a/src/collect.jl +++ b/src/collect.jl @@ -59,11 +59,11 @@ function collect_structarray(itr, elem, sz::Union{Base.HasShape, Base.HasLength} S = typeof(el) dest = initializer(S, (length(itr),)) dest[1] = el - v = collect_to_structarray!(dest, itr, 2, i) + v = _collect_to_structarray!(dest, itr, 2, i) _reshape(v, itr, sz) end -function collect_to_structarray!(dest::AbstractArray, itr, offs, st) +function _collect_to_structarray!(dest::AbstractArray, itr, offs, st) # collect to dest array, checking the type of each result. if a result does not # match, widen the result type and re-dispatch. i = offs @@ -77,7 +77,7 @@ function collect_to_structarray!(dest::AbstractArray, itr, offs, st) else new = widenstructarray(dest, i, el) @inbounds new[i] = el - return collect_to_structarray!(new, itr, i+1, st) + return _collect_to_structarray!(new, itr, i+1, st) end end return dest diff --git a/test/runtests.jl b/test/runtests.jl index f699f8b1..49f2ac41 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -375,7 +375,7 @@ collect_structarray_rec(t) = collect_structarray(t, initializer = initializer) el, st = iterate(itr) dest = initializer(typeof(el), (3,)) dest[1] = el - @inferred StructArrays.collect_to_structarray!(dest, itr, 2, st) + @inferred StructArrays._collect_to_structarray!(dest, itr, 2, st) v = [(a = 1, b = 2), (a = 1.2, b = 3)] @test collect_structarray_rec(v) == StructArray((a = [1, 1.2], b = Int[2, 3]))