From 2a5d553eb3698b7edc1be7addd55c1fd8d1be82f Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sat, 25 May 2024 11:34:23 +0530 Subject: [PATCH] Rename the internal union `OneBasedRanges` to `_OneBasedRanges` (#54079) This makes auto-completing `Base.OneTo` easier, as there's no ambiguity with this internal union. The leading underscore may also signal that the name is internal to `Base`. Co-authored-by: Max Horn --- base/subarray.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/subarray.jl b/base/subarray.jl index a782b9f6703f5..e4bf5579ff90e 100644 --- a/base/subarray.jl +++ b/base/subarray.jl @@ -351,8 +351,8 @@ FastContiguousSubArray{T,N,P,I<:Union{Tuple{Union{Slice, AbstractUnitRange}, Var # parents of FastContiguousSubArrays may support fast indexing with AbstractUnitRanges, # so we may just forward the indexing to the parent # This may only be done for non-offset ranges, as the result would otherwise have offset axes -const OneBasedRanges = Union{OneTo{Int}, UnitRange{Int}, Slice{OneTo{Int}}, IdentityUnitRange{OneTo{Int}}} -function getindex(V::FastContiguousSubArray, i::OneBasedRanges) +const _OneBasedRanges = Union{OneTo{Int}, UnitRange{Int}, Slice{OneTo{Int}}, IdentityUnitRange{OneTo{Int}}} +function getindex(V::FastContiguousSubArray, i::_OneBasedRanges) @inline @boundscheck checkbounds(V, i) @inbounds r = V.parent[_reindexlinear(V, i)]