julia> foo(a, b::Array{Int, 1}...=[0,0];c="") = @show b
foo (generic function with 3 methods)
julia> goo(a,b::Array{Array{Int, 1}, 1}) = begin
c = "c"
foo(a, b...;c)
end
goo (generic function with 3 methods)
julia> goo(1, [[1,2,3]])
ERROR: TypeError: in typeassert, expected Vector{Int64}, got a value of type Tuple{Vector{Int64}}
julia> foo2(a, b::Array{Int, 1}...;c="") = @show b
foo2 (generic function with 1 method)
julia> goo2(a,b::Array{Array{Int, 1}, 1}) = begin
c = "c"
foo2(a, b...;c)
end
goo2 (generic function with 1 method)
julia> goo2(1, [[1,2,3]])
b = ([1, 2, 3],)
([1, 2, 3],)
julia> foo3(a, b::Array{Int, 1}...=[0,0]) = @show b
foo3 (generic function with 2 methods)
julia> goo3(a,b::Array{Array{Int, 1}, 1}) = foo3(a, b...)
goo3 (generic function with 1 method)
julia> goo3(1, [[1,2,3]])
b = ([1, 2, 3],)
([1, 2, 3],)
julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, icelake-client)
Environment:
JULIA_NUM_THREADS = 6
I don’t know if this is technically a bug since I haven’t seen the usage of Vararg arguments as optional arguments on the official documentation (I might have missed it so feel free to point out); on the other hand since it’s not forbidden and yet we have this kind of errors. Initial Discourse link is here.
MWE:
System info:
Based on the differences among
foo,foo2, andfoo3, I suspect it might have something to do with the keyword argument syntax but I’m not sure.I don’t know if this is technically a bug since I haven’t seen the usage of Vararg arguments as optional arguments on the official documentation (I might have missed it so feel free to point out); on the other hand since it’s not forbidden and yet we have this kind of errors. Initial Discourse link is here.