dear out there,
I just stumbled upon the maybe most weird julia bug I experienced so far
f1(args::(Vararg{Any, N} where N); kwargs...) = (args, kwargs)
f2(args::(Vararg{Any, N} where N)) = (args, 1)
f3(args::(Vararg{Any}); kwargs...) = (args, kwargs)
@show f1(1,2,3) f2(1,2,3) f3(1,2,3)
will print
f1(1, 2, 3) = (((1, 2, 3),), Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}())
f2(1, 2, 3) = ((1, 2, 3), 1)
f3(1, 2, 3) = ((1, 2, 3), Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}())
The core difference is that for f1
the args get packed into an EXTRA level of Tuple…
Super weird, especially because
-
f1
andf2
share the same type onargs
and -
f1
andf3
share in principle the same type onargs
(as the first is an explicit UnionAll, and the second the respective implicit UnionAll)
ideas?
EDIT:
Question for building a workaround:
Is there a way to easily normalize the explicit UnionAll Vararg{Any, N} where N
into the correct behaving Vararg{Any}
?
version: this run on julia 1.2.0