Skip to content

Commit

Permalink
add IteratorSize for Char (JuliaLang#29819)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins authored and tkf committed Nov 21, 2018
1 parent 6a439ba commit 1b884e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ size(c::AbstractChar,d) = convert(Int, d) < 1 ? throw(BoundsError()) : 1
ndims(c::AbstractChar) = 0
ndims(::Type{<:AbstractChar}) = 0
length(c::AbstractChar) = 1
IteratorSize(::Type{Char}) = HasShape{0}()
firstindex(c::AbstractChar) = 1
lastindex(c::AbstractChar) = 1
getindex(c::AbstractChar) = c
Expand Down
4 changes: 4 additions & 0 deletions test/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,7 @@ end
@test reinterpret(UInt32, reinterpret(Char, u)) === u
end
end

@testset "broadcasting of Char" begin
@test identity.('a') == 'a'
end

0 comments on commit 1b884e7

Please sign in to comment.