diff --git a/src/IterTools.jl b/src/IterTools.jl index bf3b355..e7417c2 100644 --- a/src/IterTools.jl +++ b/src/IterTools.jl @@ -1164,8 +1164,8 @@ end struct ZipLongest{IS<:Tuple} is::IS end -IteratorSize(::Type{ZipLongest{Is}}) where {Is<:Tuple} = Base.Iterators.zip_iteratorsize(ntuple(n -> IteratorSize(fieldtype(Is, n)), Base.Iterators._counttuple(Is)::Int)...) -IteratorEltype(::Type{ZipLongest{Is}}) where {Is<:Tuple} = Base.Iterators.zip_iteratoreltype(ntuple(n -> IteratorEltype(fieldtype(Is, n)), Base.Iterators._counttuple(Is)::Int)...) +IteratorSize(::Type{ZipLongest{Is}}) where {Is<:Tuple} = Base.Iterators.zip_iteratorsize(ntuple(n -> IteratorSize(fieldtype(Is, n)), fieldcount(Is))...) +IteratorEltype(::Type{ZipLongest{Is}}) where {Is<:Tuple} = Base.Iterators.zip_iteratoreltype(ntuple(n -> IteratorEltype(fieldtype(Is, n)), fieldcount(Is))...) eltype(::Type{ZipLongest{Is}}) where {Is<:Tuple} = TupleOrBottom(map(eltype, fieldtypes(Is))...) length(it::ZipLongest) = maximum(length.(it.is)) size(it::ZipLongest) = mapreduce(size, _zip_longest_promote_shape, it.is) diff --git a/test/runtests.jl b/test/runtests.jl index 2b375dc..856d1f1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -605,6 +605,8 @@ include("testing_macros.jl") a = 1:5 b = 10:-1:8 it = zip_longest(a,b,default=-1) + @test IteratorSize(typeof(it)) == Base.HasShape{1}() + @test IteratorEltype(typeof(it))) == Base.HasEltype() @test collect(it) == [(1,10),(2,9),(3,8),(4,-1),(5,-1)] @test eltype(it) == Tuple{Int, Int}