From fbae56617a779ba5f09910d660a2ec9472d0b194 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Sat, 29 Aug 2026 01:24:56 +0300 Subject: [PATCH 1/2] Replace _counttuple with fieldcount --- src/IterTools.jl | 4 ++-- test/runtests.jl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) 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..0b83c51 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(it) == Base.HasShape{1}() + @test IteratorEltype(it) == Base.HasEltype() @test collect(it) == [(1,10),(2,9),(3,8),(4,-1),(5,-1)] @test eltype(it) == Tuple{Int, Int} From eafd3df92e6978745a577ef5459e2ac53ab00d79 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 4 Sep 2026 12:27:17 +0200 Subject: [PATCH 2/2] Update test/runtests.jl Co-authored-by: Frames White --- test/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 0b83c51..856d1f1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -605,8 +605,8 @@ include("testing_macros.jl") a = 1:5 b = 10:-1:8 it = zip_longest(a,b,default=-1) - @test IteratorSize(it) == Base.HasShape{1}() - @test IteratorEltype(it) == Base.HasEltype() + @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}