Skip to content

Commit 51bb7f0

Browse files
committed
Switch to SizeUnknown
1 parent 388330e commit 51bb7f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/comparison.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,11 @@ end
470470

471471
Base.eltype(::Type{ExponentsIterator{M,D,O}}) where {M,D,O} = O
472472
function Base.IteratorSize(::Type{<:ExponentsIterator{M,Nothing}}) where {M}
473-
return Base.IsInfinite()
473+
# It could be `HasLength` is `IsInfinite` depending on whether `it.object`
474+
# is empty so the size is unknown when we only have access to the type of
475+
# the iterator. The method below gives the correct size when we have access
476+
# to the instance
477+
return Base.SizeUnknown()
474478
end
475479
function Base.IteratorSize(it::ExponentsIterator{M,Nothing}) where {M}
476480
if isempty(it.object)

0 commit comments

Comments
 (0)