Skip to content

Commit f8e50b0

Browse files
committed
Fix getindex(::OptionallyStaticUnitRange, ::UnitRange) type instability
1 parent 531e825 commit f8e50b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ranges.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ end
229229
@propagate_inbounds function Base.getindex(r::OptionallyStaticUnitRange, s::AbstractUnitRange{<:Integer})
230230
@boundscheck checkbounds(r, s)
231231
f = static_first(r)
232-
f = f - one(f)
233-
return (f + static_first(s)):(f + static_last(s))
232+
fnew = f - one(f)
233+
return (fnew + static_first(s)):(fnew + static_last(s))
234234
end
235235

236236
@propagate_inbounds function Base.getindex(r::OptionallyStaticUnitRange, i::Integer)

0 commit comments

Comments
 (0)