Skip to content

Commit

Permalink
Rename IsIterable to IsIterator (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff authored and mauro3 committed Mar 19, 2017
1 parent 0ca18aa commit e326468
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/base-traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using SimpleTraits
using Compat

export IsLeafType, IsBits, IsImmutable, IsContiguous, IsIndexLinear,
IsAnything, IsNothing, IsCallable, IsIterable
IsAnything, IsNothing, IsCallable, IsIterator

"Trait which contains all types"
@traitdef IsAnything{X}
Expand Down Expand Up @@ -57,10 +57,10 @@ end

Base.@deprecate_binding IsFastLinearIndex IsIndexLinear

"Trait of all iterable types"
@traitdef IsIterable{X}
@generated function SimpleTraits.trait{X}(::Type{IsIterable{X}})
method_exists(start, Tuple{X}) ? :(IsIterable{X}) : :(Not{IsIterable{X}})
"Trait of all iterator types"
@traitdef IsIterator{X}
@generated function SimpleTraits.trait{X}(::Type{IsIterator{X}})
method_exists(start, Tuple{X}) ? :(IsIterator{X}) : :(Not{IsIterator{X}})
end

end # module
8 changes: 4 additions & 4 deletions test/base-traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ c = view(a, 1:2:5)
type T9867 end
@test istrait(IsCallable{T9867})

@test istrait(IsIterable{Array})
@test !istrait(IsIterable{Cmd})
@test istrait(IsIterable{Base.UnitRange{Int}})
@test istrait(IsIterable{Base.UnitRange})
@test istrait(IsIterator{Array})
@test !istrait(IsIterator{Cmd})
@test istrait(IsIterator{Base.UnitRange{Int}})
@test istrait(IsIterator{Base.UnitRange})

0 comments on commit e326468

Please sign in to comment.