diff --git a/base/channels.jl b/base/channels.jl index 784a7d6de9781f..4d1833d360fd2e 100644 --- a/base/channels.jl +++ b/base/channels.jl @@ -246,9 +246,10 @@ Append an item `v` to the channel `c`. Blocks if the channel is full. For unbuffered channels, blocks until a [`take!`](@ref) is performed by a different task. """ -function put!(c::Channel, v) +function put!(c::Channel{T}, v) where T check_channel_state(c) - isbuffered(c) ? put_buffered(c,v) : put_unbuffered(c,v) + vT = convert(T, v) + isbuffered(c) ? put_buffered(c,vT) : put_unbuffered(c,vT) end function put_buffered(c::Channel, v)