From 63b9fa03d5c46b8b1f76ce66f1f218f3c7182e63 Mon Sep 17 00:00:00 2001 From: Alexander Barth Date: Fri, 12 Apr 2024 16:43:41 +0200 Subject: [PATCH] Resolve checkbounds ambiguities with Base.LogicalIndex (see https://github.com/JuliaMath/Interpolations.jl/commit/650a596d24369e126f3ce7c7ab54dd894698a5c3) --- src/CommonDataModel.jl | 1 + src/memory_dataset.jl | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/CommonDataModel.jl b/src/CommonDataModel.jl index c10de70..61a01ad 100644 --- a/src/CommonDataModel.jl +++ b/src/CommonDataModel.jl @@ -8,6 +8,7 @@ using Printf using Preferences using DataStructures import Base: + LogicalIndex, checkbounds, close, collect, diff --git a/src/memory_dataset.jl b/src/memory_dataset.jl index ab05899..f4bf98e 100644 --- a/src/memory_dataset.jl +++ b/src/memory_dataset.jl @@ -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