From f22e84e8eb34f90b04f6407e4ea5bb6f895f2feb Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 10 Mar 2016 22:56:39 -0500 Subject: [PATCH] add `iteratorsize(::Type{StreamMapIterator})` and cleanup from rebase --- base/iterator.jl | 2 +- base/mapiterator.jl | 2 ++ test/functional.jl | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/base/iterator.jl b/base/iterator.jl index d80659013fc5d..bb96f02fe1034 100644 --- a/base/iterator.jl +++ b/base/iterator.jl @@ -10,7 +10,7 @@ _min_length(a, b, A, B) = min(length(a),length(b)) _diff_length(a, b, A, ::IsInfinite) = 0 _diff_length(a, b, ::IsInfinite, ::IsInfinite) = 0 _diff_length(a, b, ::IsInfinite, B) = length(a) # inherit behaviour, error -_diff_length(a, b, A, B) = max(length(a)-length(b), 0) +_diff_length(a, b, A, B) = max(length(a)-length(b), 0) # enumerate diff --git a/base/mapiterator.jl b/base/mapiterator.jl index 75bde41ed6c85..edb64dabe8ff4 100644 --- a/base/mapiterator.jl +++ b/base/mapiterator.jl @@ -144,3 +144,5 @@ function next(itr::StreamMapIterator, state::StreamMapState) return (r, state) end + +iteratorsize(::Type{StreamMapIterator}) = SizeUnknown() diff --git a/test/functional.jl b/test/functional.jl index d59f43c2c70a9..23d4c320ad364 100644 --- a/test/functional.jl +++ b/test/functional.jl @@ -88,7 +88,7 @@ let s = "hello" @test collect(rest(s, st)) == ['e','l','l','o'] end -@test_throws MethodError collect(rest(countfrom(1), 5)) +@test_throws MethodError collect(rest(countfrom(1), 5)) # countfrom # ---------