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
  • Loading branch information
vtjnash authored Sep 1, 2023
1 parent 91b8c9b commit 3527213
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 @@ -1583,10 +1583,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 3527213

Please sign in to comment.