Skip to content

Commit bb465d3

Browse files
Add eltype for RemoteChannel (JuliaLang/julia#35100)
1 parent 8d6243b commit bb465d3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/remotecall.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
import Base: eltype
4+
35
abstract type AbstractRemoteRef end
46

57
"""
@@ -119,6 +121,8 @@ function RemoteChannel(f::Function, pid::Integer=myid())
119121
end
120122
end
121123

124+
Base.eltype(::Type{RemoteChannel{T}}) where {T} = eltype(T)
125+
122126
hash(r::AbstractRemoteRef, h::UInt) = hash(r.whence, hash(r.id, h))
123127
==(r::AbstractRemoteRef, s::AbstractRemoteRef) = (r.whence==s.whence && r.id==s.id)
124128

test/distributed_exec.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ remote_do(fut->put!(fut, myid()), id_other, f)
834834

835835
# Github issue #29932
836836
rc_unbuffered = RemoteChannel(()->Channel{Vector{Float64}}(0))
837+
@test eltype(rc_unbuffered) == Vector{Float64}
837838

838839
@async begin
839840
# Trigger direct write (no buffering) of largish array

0 commit comments

Comments
 (0)