Skip to content

Commit

Permalink
Ensure print(io,x) is inferrable
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloferz committed Jul 13, 2016
1 parent fcf92cd commit 4a48215
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/strings/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function print(io::IO, x)
finally
unlock(io)
end
return nothing
end

function print(io::IO, xs...)
Expand All @@ -20,6 +21,7 @@ function print(io::IO, xs...)
finally
unlock(io)
end
return nothing
end

println(io::IO, xs...) = print(io, xs..., '\n')
Expand Down
4 changes: 4 additions & 0 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,7 @@ end

# Issue 17314
@test broadcast(x->log(log(log(x))), [1000]) == [log(log(log(1000)))]
let io = IOBuffer()
broadcast(x->print(io,x), 1:5) # broadcast with side effects
@test takebuf_array(io) == [0x31,0x32,0x33,0x34,0x35]
end

0 comments on commit 4a48215

Please sign in to comment.