Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"tuple must be non-empty" when iterating two nested Iterators.product #28753

Closed
fjarri opened this issue Aug 19, 2018 · 1 comment
Closed

"tuple must be non-empty" when iterating two nested Iterators.product #28753

fjarri opened this issue Aug 19, 2018 · 1 comment
Labels
iteration Involves iteration or the iteration protocol

Comments

@fjarri
Copy link
Contributor

fjarri commented Aug 19, 2018

The code:

using Base.Iterators: product
println(collect(product(product())))

Expected:

(ProductIterator{Tuple{}}(()),)

(or something of that sort, in the real code I have

iters = product(product(...))
for x in iters
    for y in x
        ...
    end
end

)

Got:

ERROR: LoadError: ArgumentError: tuple must be non-empty
Stacktrace:
 [1] first(::Tuple{}) at ./tuple.jl:74
 [2] _pisdone at ./iterators.jl:803 [inlined]
 [3] isdone at ./iterators.jl:810 [inlined]
 [4] _pisdone at ./iterators.jl:804 [inlined]
 [5] isdone at ./iterators.jl:810 [inlined]
 [6] iterate at ./iterators.jl:842 [inlined]
 [7] copyto!(::Array{Tuple{Tuple{}},0}, ::Base.Iterators.ProductIterator{Tuple{Base.Iterators.ProductIterator{Tuple{}}}}) at ./abstractarray.jl:650
 [8] _collect(::UnitRange{Int64}, ::Base.Iterators.ProductIterator{Tuple{Base.Iterators.ProductIterator{Tuple{}}}}, ::Base.HasEltype, ::Base.HasShape{0}) at ./array.jl:563
 [9] collect(::Base.Iterators.ProductIterator{Tuple{Base.Iterators.ProductIterator{Tuple{}}}}) at ./array.jl:557
 [10] top-level scope at none:0
 [11] include at ./boot.jl:317 [inlined]
 [12] include_relative(::Module, ::String) at ./loading.jl:1038
 [13] include(::Module, ::String) at ./sysimg.jl:29
 [14] exec_options(::Base.JLOptions) at ./client.jl:229
 [15] _start() at ./client.jl:421

versioninfo():

Julia Version 1.0.0
Commit 5d4eaca (2018-08-08 20:58 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin14.5.0)
CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, haswell)

@brenhinkeller brenhinkeller added the iteration Involves iteration or the iteration protocol label Nov 21, 2022
@barucden
Copy link
Contributor

This issue seems to have been fixed by #43947.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iteration Involves iteration or the iteration protocol
Projects
None yet
Development

No branches or pull requests

4 participants