Skip to content

Commit

Permalink
simplify call to promote_eltype with repeated elements (#51135)
Browse files Browse the repository at this point in the history
Helps to short-circuit calls to large splat calls, since those have all
the same type elements.

Fixes #51011

(cherry picked from commit 3527213)
  • Loading branch information
vtjnash authored and KristofferC committed Nov 28, 2023
1 parent 465ff74 commit b497f44
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1591,10 +1591,14 @@ eltypeof(x::AbstractArray) = eltype(x)
promote_eltypeof() = error()
promote_eltypeof(v1) = eltypeof(v1)
promote_eltypeof(v1, vs...) = promote_type(eltypeof(v1), promote_eltypeof(vs...))
promote_eltypeof(v1::T, vs::T...) where {T} = eltypeof(v1)
promote_eltypeof(v1::AbstractArray{T}, vs::AbstractArray{T}...) where {T} = T

promote_eltype() = error()
promote_eltype(v1) = eltype(v1)
promote_eltype(v1, vs...) = promote_type(eltype(v1), promote_eltype(vs...))
promote_eltype(v1::T, vs::T...) where {T} = eltype(T)
promote_eltype(v1::AbstractArray{T}, vs::AbstractArray{T}...) where {T} = T

#TODO: ERROR CHECK
_cat(catdim::Int) = Vector{Any}()
Expand Down

0 comments on commit b497f44

Please sign in to comment.