-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorkeyword argumentsf(x; keyword=arguments)f(x; keyword=arguments)
Description
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
Vararg{Any} === Vararg{Any, N} where N
givestrue
version: this run on julia 1.2.0
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorkeyword argumentsf(x; keyword=arguments)f(x; keyword=arguments)