-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inference failure when splatting a number #19957
Comments
It's due to splatting of a number and not a tuple. julia> f(x) = (x...)
f (generic function with 1 method)
julia> @code_warntype f(1)
Variables:
#self#::#f
x::Int64
Body:
begin
return (Core._apply)(Core.tuple,x::Int64)::Tuple
end::Tuple
julia> f(1)
(1,) |
And this seems to be caused by the special handling of |
would be fixed by #12579 then? |
Sort of. Although it doesn't infer the length? |
As long as numbers are iterable (which, most likely, they will continue to be) it's worth adding handling for this to |
This has now been fixed: julia> @code_warntype g(f, (1,))
Variables:
#self#::#g
f::#f
x::Tuple{Int64}
Body:
begin
return (Core.tuple)((Core.getfield)(x::Tuple{Int64}, 1)::Int64, 1)::Tuple{Int64,Int64}
end::Tuple{Int64,Int64} |
could use a test |
Good point. |
a partial related test was added in #20343, but it looks a bit different? |
Does this really just need a test in order to close it? |
Minimal reproducible example:
cc @jrevels
The text was updated successfully, but these errors were encountered: