-
-
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 in negating a list of lists #49941
Comments
Minimal example: julia> bvv = Base.broadcasted(-, [[1],[2]])
Base.Broadcast.Broadcasted(-, ([[1], [2]],))
julia> @inferred Base.materialize(bvv)
ERROR: return type Vector{Vector{Int64}} does not match inferred return type Any
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] top-level scope
@ REPL[41]:1
julia> @code_warntype Base.materialize(bvv)
MethodInstance for Base.Broadcast.materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(-), Tuple{Vector{Vector{Int64}}}})
from materialize(bc::Base.Broadcast.Broadcasted) @ Base.Broadcast broadcast.jl:903
Arguments
#self#::Core.Const(Base.Broadcast.materialize)
bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(-), Tuple{Vector{Vector{Int64}}}}
Body::Vector{Vector{Int64}}
1 ─ nothing
│ %2 = Base.Broadcast.instantiate(bc)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Tuple{Base.OneTo{Int64}}, typeof(-), Tuple{Vector{Vector{Int64}}}}
│ %3 = Base.Broadcast.copy(%2)::Vector{Vector{Int64}}
└── return %3 How is it possible for |
Is there a reason why
Naively specializing in the REPL infers after hitting some form of #35800
So there may be a lot going on here :) |
this (specific MWE given) does not reproduce on master |
Great! |
I feel like this should infer.
I ran into this because it caused dynamic dispatch that resulted in a performance bottleneck in some code I was writing. I'm switching to
Vector{StaticArrays.SVector{2, Int64}}
which does infer, so this is no longer an issue for me, but I'm still logging it because it seems odd and perhaps a place for inference to improve (if that wouldn't slow down inference time).The text was updated successfully, but these errors were encountered: