Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Not sure what the previous definition of IteratorSize was trying to do, but it was wrong for IsInfinite. Not sure what the correct answer is for HasShape.
  • Loading branch information
denizyuret authored Jan 8, 2019
1 parent 34f7a4a commit 6869ae1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1089,10 +1089,9 @@ end

@inline peek(s::Stateful, sentinel=nothing) = s.nextvalstate !== nothing ? s.nextvalstate[1] : sentinel
@inline iterate(s::Stateful, state=nothing) = s.nextvalstate === nothing ? nothing : (popfirst!(s), nothing)
IteratorSize(::Type{Stateful{VS,T}} where VS) where {T} =
isa(IteratorSize(T), SizeUnknown) ? SizeUnknown() : HasLength()
IteratorSize(::Type{Stateful{T,VS}}) where {T,VS} = IteratorSize(T)
eltype(::Type{Stateful{T, VS}} where VS) where {T} = eltype(T)
IteratorEltype(::Type{Stateful{VS,T}} where VS) where {T} = IteratorEltype(T)
IteratorEltype(::Type{Stateful{T,VS}}) where {T,VS} = IteratorEltype(T)
length(s::Stateful) = length(s.itr) - s.taken

end

0 comments on commit 6869ae1

Please sign in to comment.