Skip to content

Unexpected TypeError: in Vararg, in type, expected Type, got Vararg{Union{Float64, AbstractArray}} in Julia 1.9 #48950

@kmeers-kuleuven

Description

@kmeers-kuleuven

One of the tests of https://gitlab.kuleuven.be/ppw-okpiv/research/GradientDiffusion.jl/ fails in Julia 1.9-beta/rc1 with ERROR: TypeError: in Vararg, in type, expected Type, got Vararg{Union{Float64, AbstractArray}}. In Julia 1.8 it works without issues.

This is a minimal working/failing example:

module j
    struct k{
        b,
        c}
        d
        function k(e::Vararg{Union{b, AbstractArray}}) where b
            c = Union
            new{b, c}(e)
        end
    end
    l(a) = getfield(a, :d)
    function a(b, c)
        c(l(b[])...)
    end
    function o(a)
        function(b, ::Vararg{Union{c, AbstractArray}}) where {c, d}
        end
    end
    function fit(z, f, d)
        b = [ k([0.], 0.) ]
        a(b, (i...) -> d(z, i...))
    end
end
c = d = []
j.fit(j, d, j.o(c))

Output in Julia 1.8:

Output in Julia 1.9:

ERROR: TypeError: in Vararg, in type, expected Type, got Vararg{Union{Float64, AbstractArray}}
Stacktrace:
 [1] (::Main.j.var"#3#4"{Module, Main.j.var"#1#2"})(::Vector{Float64}, ::Vararg{Any})
   @ Main.j .\REPL[7]:21
 [2] a
   @ .\REPL[7]:13 [inlined]
 [3] fit(z::Module, f::Vector{Any}, d::Function)
   @ Main.j .\REPL[7]:21
 [4] top-level scope
   @ REPL[9]:1

The example is reproducible in Windows and Linux.
i.e. of versioninfo():

Julia Version 1.9.0-rc1
Commit 3b2e0d8fbc (2023-03-07 07:51 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 8 on 8 virtual cores
Environment:
  JULIA_EDITOR = code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions