diff --git a/base/abstractarray.jl b/base/abstractarray.jl index 48f03ab2f07a0..0e7a9da38c7fe 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -2189,13 +2189,13 @@ end _typed_hvncat(T::Type, dim::Int, ::Bool, xs...) = _typed_hvncat(T, Val(dim), xs...) # catches from _hvncat type promoters _typed_hvncat(::Type{T}, ::Val) where T = Vector{T}() -_typed_hvncat(T::Type, ::Val{N}, xs::Number...) where N = _typed_hvncat(T, (ntuple(x -> 1, N - 1)..., length(xs)), false, xs...) +_typed_hvncat(T::Type, ::Val{N}, xs::Number...) where N = _typed_hvncat(T, (ntuple(x -> 1, Val(N - 1))..., length(xs)), false, xs...) function _typed_hvncat(::Type{T}, ::Val{N}, as::AbstractArray...) where {T, N} # optimization for arrays that can be concatenated by copying them linearly into the destination # conditions: the elements must all have 1- or 0-length dimensions above N for a ∈ as ndims(a) <= N || all(x -> size(a, x) == 1, (N + 1):ndims(a)) || - return _typed_hvncat(T, (ntuple(x -> 1, N - 1)..., length(as)), false, as...) + return _typed_hvncat(T, (ntuple(x -> 1, Val(N - 1))..., length(as)), false, as...) end nd = N @@ -2230,7 +2230,7 @@ function _typed_hvncat(::Type{T}, ::Val{N}, as...) where {T, N} nd = max(nd, cat_ndims(as[i])) end - A = Array{T, nd}(undef, ntuple(x -> 1, N - 1)..., Ndim, ntuple(x -> 1, nd - N)...) + A = Array{T, nd}(undef, ntuple(x -> 1, Val(N - 1))..., Ndim, ntuple(x -> 1, nd - N)...) k = 1 for a ∈ as