Skip to content

Commit

Permalink
Resolve checkbounds ambiguities with Base.LogicalIndex (see JuliaMath…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Apr 12, 2024
1 parent 8301e61 commit 63b9fa0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CommonDataModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using Printf
using Preferences
using DataStructures
import Base:
LogicalIndex,
checkbounds,
close,
collect,
Expand Down
12 changes: 11 additions & 1 deletion src/memory_dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ import CommonDataModel as CDM

Base.size(RA::ResizableArray) = size(RA.A)
Base.getindex(RA::ResizableArray,inds...) = getindex(RA.A,inds...)
Base.checkbounds(::Type{Bool},RA::ResizableArray,inds::Union{Integer,AbstractVector{<:Integer}}...) = all(minimum.(inds) .> 0)

@inline _checkbounds(RA::ResizableArray,inds...) = all(minimum.(inds) .> 0)

@inline Base.checkbounds(::Type{Bool},RA::ResizableArray,inds::Union{Integer,AbstractVector{<:Integer}}...) =
_checkbounds(RA,inds)

@inline checkbounds(::Type{Bool}, itp::ResizableArray, x::LogicalIndex) =
_checkbounds(RA,inds)

@inline checkbounds(::Type{Bool}, itp::ResizableArray, x::LogicalIndex{<:Any,<:AbstractVector{Bool}}) =
_checkbounds(RA,inds)

function grow!(RA::ResizableArray{T,N},new_size) where {T,N}
# grow
Expand Down

0 comments on commit 63b9fa0

Please sign in to comment.