You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is in intersect(r::AbstractUnitRange{<:Integer}, s::StepRange{<:Integer}) which has some branches which return unit ranges and some which return step ranges. For similar reasons the eltype appears to be uninferrable when ranges based on different integer types are mixed.
While preparing a fix for this, I came across a problem with StepRange{<:Integer}s with non-integer step (#32419), in which case intersect(r::AbstractUnitRange{<:Integer}, s::StepRange{<:Integer}) returns a wrong result (it expects the step of s to be integer). IMO, the assumption that a StepRange{<:Integer} has an integer step is reasonable, so I don’t think this needs to be fixed in intersect. I will nevertheless wait for a decision on #32419 before making a PR for this issue.
In the following examples,
intersect
is not type-stable:The type-instabilities also occur if the positions of the arguments are switched.
Edit: added another example
The text was updated successfully, but these errors were encountered: