Skip to content

Spurious deprecation warning from Vararg !<: Type #49553

Closed
@timholy

Description

@timholy

I don't understand why this function definition seems prohibited (running with --depwarn=error):

julia> struct CenterIndexedArray{T,N,A<:AbstractArray} <: AbstractArray{T,N}
           data::A
           halfsize::NTuple{N,Int}

           function CenterIndexedArray{T,N,A}(data::A) where {T,N,A<:AbstractArray}
               new{T,N,A}(data, _halfsize(data))
           end
       end

julia> CenterIndexedArray(A::AbstractArray{T,N}) where {T,N} = CenterIndexedArray{T,N,typeof(A)}(A)
CenterIndexedArray

julia> CenterIndexedArray{T,N}(::UndefInitializer, sz::Vararg{<:Integer,N}) where {T,N} =
           CenterIndexedArray(Array{T,N}(undef, sz...))
ERROR: Wrapping `Vararg` directly in UnionAll is deprecated (wrap the tuple instead).
Stacktrace:
 [1] UnionAll(v::TypeVar, t::Any)
   @ Core ./boot.jl:257
 [2] top-level scope
   @ REPL[3]:1

xref #38136, CC @Keno

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions