Skip to content

Commit 08445af

Browse files
favbaJeffBezanson
authored andcommitted
Change Type{Ref{T}} to Type{<:Ref{T}} (#26364)
1 parent e050ab6 commit 08445af

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/refpointer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ end
3333

3434
### General Methods for Ref{T} type
3535

36-
eltype(x::Type{Ref{T}}) where {T} = T
36+
eltype(x::Type{<:Ref{T}}) where {T} = @isdefined(T) ? T : Any
3737
convert(::Type{Ref{T}}, x::Ref{T}) where {T} = x
3838

3939
# create Ref objects for general object conversion

test/core.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6010,3 +6010,6 @@ g25907a(x) = x[1]::Integer
60106010
@test g25907a(Union{Int, UInt, Nothing}[1]) === 1
60116011
g25907b(x) = x[1]::Complex
60126012
@test g25907b(Union{Complex{Int}, Complex{UInt}, Nothing}[1im]) === 1im
6013+
6014+
#issue #26363
6015+
@test eltype(Ref(Float64(1))) === Float64

0 commit comments

Comments
 (0)