JuliaDynamics / StateSpaceSets.jl

The `StateSpaceSet` interface for packages of JuliaDynamics
MIT License
2 stars 3 forks source link

Vararg deprecation warnings while compiling #26

Closed dhanak closed 2 months ago

dhanak commented 2 months ago

Describe the bug The package causes some Vararg deprecation warnings while compiling with Julia >=1.7.

WARNING: Wrapping Vararg directly in UnionAll is deprecated (wrap the tuple instead). You may need to write f(x::Vararg{T}) rather than f(x::Vararg{<:T}) or f(x::Vararg{T}) where T instead of f(x::Vararg{T} where T).

This doesn't occur during precompilation, but when JIT compiling certain functions. Vararg occurs in six lines in the source code, these are:

  1. statespaceset.jl:110
  2. statespaceset.jl:128
  3. statespaceset_concrete.jl:71
  4. statespaceset_concrete.jl:87
  5. statespaceset_concrete.jl:91
  6. statespaceset_concrete.jl:158

Items 1-5 all violate the deprecation check.

Minimal Working Example

Running the package's own tests with julia --depwarn=yes --project -e "using Pkg; Pkg.test()" reproduces the warning.

Package versions

  [639c3291] RecurrenceAnalysis v2.0.6
  [40b095a5] StateSpaceSets v1.4.5
dhanak commented 2 months ago

So, I was wondering why Varargs are necessary in the function definitions at all. IIUC, this

StateSpaceSet(xs::Vararg{Union{AbstractVector, AbstractStateSpaceSet}}) = hcat(xs...)

should be written like this instead:

StateSpaceSet(xs::Union{AbstractVector, AbstractStateSpaceSet}...) = hcat(xs...)

and roughly the same goes for all other five locations as well.

Datseris commented 2 months ago

Yeah it is some veeeeeery very old code pre 1.0 Julia. Would you mind putting in a Pr that changes to what you proposed ?