Skip to content

Commit de8f8e3

Browse files
committed
use only type in traits
1 parent e4c3a3f commit de8f8e3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

base/range.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,8 @@ copy(r::AbstractRange) = r
859859
# This is especially important for wrapper types, as they may choose the
860860
# use the parent's iterate method instead of the fallback implementation by defining
861861
# their IterationStyle to be the same as their parents'.
862-
struct IterationStyle{T}
863-
x :: T
864-
end
862+
struct IterationStyle{T} end
863+
IterationStyle(x) = IterationStyle{typeof(x)}()
865864

866865
iterate(r::Union{StepRangeLen, LinRange}, i::Integer = zero(length(r))) = _iterate(r, IterationStyle(r), i)
867866
function _iterate(r::AbstractArray, ::IterationStyle{<:AbstractRange}, i = zero(length(r)))

0 commit comments

Comments
 (0)