diff --git a/src/remotecall.jl b/src/remotecall.jl index 644ff04..6abd821 100644 --- a/src/remotecall.jl +++ b/src/remotecall.jl @@ -413,8 +413,8 @@ function serialize(s::AbstractSerializer, ::Future) invoke(serialize, Tuple{AbstractSerializer, Any}, s, zero_fut) end -function serialize(s::AbstractSerializer, ::RemoteChannel) - zero_rc = RemoteChannel{Channel{Any}}((0,0,0)) +function serialize(s::AbstractSerializer, ::RemoteChannel{T}) where T + zero_rc = RemoteChannel{T}((0,0,0)) invoke(serialize, Tuple{AbstractSerializer, Any}, s, zero_rc) end diff --git a/test/distributed_exec.jl b/test/distributed_exec.jl index a218bf6..19d10eb 100644 --- a/test/distributed_exec.jl +++ b/test/distributed_exec.jl @@ -343,9 +343,12 @@ end @testset "Ser/deser to non-ClusterSerializer objects" begin function test_regular_io_ser(ref::DistributedNext.AbstractRemoteRef) io = IOBuffer() - serialize(io, ref) + # Wrapping the ref in a Dict to exercise the case when the + # type parameter of the RemoteChannel is part of an outer type. + # See https://github.com/JuliaLang/Distributed.jl/issues/178 + serialize(io, Dict("ref" => ref)) seekstart(io) - ref2 = deserialize(io) + ref2 = deserialize(io)["ref"] for fld in fieldnames(typeof(ref)) v = getfield(ref2, fld) if isa(v, Number) @@ -361,6 +364,7 @@ end test_regular_io_ser(Future()) test_regular_io_ser(RemoteChannel()) + test_regular_io_ser(RemoteChannel(() -> Channel{Bool}(1))) end @testset "@distributed and [un]buffered reads" begin