diff --git a/base/iterators.jl b/base/iterators.jl index 1a9dd73de7d82..8cf92aac8ff40 100644 --- a/base/iterators.jl +++ b/base/iterators.jl @@ -1083,6 +1083,7 @@ iterate(::ProductIterator{Tuple{}}, state) = nothing done1 === true || return done1 # false or missing return _pisdone(tail(iters), tail(states)) # check tail end +@inline isdone(::ProductIterator{Tuple{}}, states) = true @inline isdone(P::ProductIterator, states) = _pisdone(P.iterators, states) @inline _piterate() = () diff --git a/test/iterators.jl b/test/iterators.jl index 56a178eca8ed9..9132c7b8a23a8 100644 --- a/test/iterators.jl +++ b/test/iterators.jl @@ -987,3 +987,11 @@ end @test !Base.isdone(gen) @test collect(gen) == ["foo"] end + +@testset "empty product iterators" begin + v = nothing + for (z,) in zip(Iterators.product()) + v = z + end + @test v == () +end