Skip to content

Commit ef785af

Browse files
committed
Ref to Cycle PR
1 parent 51bb7f0 commit ef785af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/comparison.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,14 @@ struct ExponentsIterator{M,D<:Union{Nothing,Int},O}
469469
end
470470

471471
Base.eltype(::Type{ExponentsIterator{M,D,O}}) where {M,D,O} = O
472+
# `IteratorSize` returns something different depending on whether it is called
473+
# in an instance or on the type. `Iterators.Cycle` has the same behavior,
474+
# see https://github.com/JuliaLang/julia/pull/54187
472475
function Base.IteratorSize(::Type{<:ExponentsIterator{M,Nothing}}) where {M}
473476
# It could be `HasLength` is `IsInfinite` depending on whether `it.object`
474477
# is empty so the size is unknown when we only have access to the type of
475478
# the iterator. The method below gives the correct size when we have access
476-
# to the instance
479+
# to the instance.
477480
return Base.SizeUnknown()
478481
end
479482
function Base.IteratorSize(it::ExponentsIterator{M,Nothing}) where {M}

0 commit comments

Comments
 (0)