julia
798e4473 - Fix JET warning related to `_array_for` (#60461)

Commit
3 days ago
Fix JET warning related to `_array_for` (#60461) Calls to this method are produced by syntax lowering for simple typed comprehensions. The current signature is ambiguous, making JET believe that the modified method could have ended up invoking itself. Resolve this by renaming the other methods. These are the the warnings I am seeing while JETing a package: ``` ││┌ _array_for(::Type{T}, itr::AbstractVector{T} where T<:NCRingElement, isz::Any) where T @ Base ./array.jl:673 │││┌ _array_for(::Type, itr::Base.SizeUnknown, isz::Any) @ Base ./array.jl:673 ││││┌ _similar_shape(itr::Base.SizeUnknown, ::Base.HasLength) @ Base ./array.jl:657 │││││ no matching method found `length(::Base.SizeUnknown)`: length(itr::Base.SizeUnknown) ││││└──────────────────── ││││┌ _similar_shape(itr::Base.SizeUnknown, ::Base.HasShape) @ Base ./array.jl:658 │││││┌ axes(A::Base.SizeUnknown) @ Base ./abstractarray.jl:98 ││││││ no matching method found `size(::Base.SizeUnknown)`: size(A::Base.SizeUnknown) │││││└──────────────────── ``` and ``` ││││││││┌ Base.AnnotatedString(s::String, annots::Any) @ Base ./strings/annotated.jl:107 │││││││││┌ collect(::Type{@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}}, itr::Any) @ Base ./array.jl:641 ││││││││││┌ _collect(::Type{@NamedTuple{…}}, itr::Any, isz::Union{Base.HasLength, Base.HasShape}) @ Base ./array.jl:643 │││││││││││┌ _array_for(::Type{@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}}, itr::Base.HasLength, isz::Any) @ Base ./array.jl:673 ││││││││││││┌ _similar_shape(itr::Base.HasLength, ::Base.HasLength) @ Base ./array.jl:657 │││││││││││││ no matching method found `length(::Base.HasLength)`: length(itr::Base.HasLength) ││││││││││││└──────────────────── ││││││││││││┌ _similar_shape(itr::Base.HasLength, ::Base.HasShape) @ Base ./array.jl:658 │││││││││││││┌ axes(A::Base.HasLength) @ Base ./abstractarray.jl:98 ││││││││││││││ no matching method found `size(::Base.HasLength)`: size(A::Base.HasLength) │││││││││││││└──────────────────── ││││││││││││┌ _array_for(::Type{@NamedTuple{region::UnitRange{Int64}, label::Symbol, value}}, itr::Base.HasLength, isz::Nothing) @ Base ./array.jl:673 │││││││││││││ no matching method found `_similar_shape(::Base.HasLength, ::Nothing)`: Base._similar_shape(itr::Base.HasLength, isz::Nothing) ││││││││││││└──────────────────── ```
Author
Committer
Parents
Loading