Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OffsetArrays ambiguity resolution again #8

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ url = "https://github.com/Vexatos/CircularArrays.jl"
version = "1.1.1"

[deps]
# The OffsetArrays dependency is not used.
# It's listed as a dependency to allow a compat entry, since versions earlier
# than OffsetArrays 1.3 would cause method ambiguities with this package,
# which are triggered by similar(arr) when arr.data::OffsetArray.
# See #3, #8 and OffsetArrays#6.
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"

[compat]
OffsetArrays = "1.1.2"
OffsetArrays = "1.3"
julia = "1.3"
4 changes: 0 additions & 4 deletions src/CircularArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ CircularArray(def::T, size) where T = CircularArray(fill(def, size))
@inline Base.similar(arr::CircularArray, ::Type{T}, dims::Tuple{Base.DimOrInd, Vararg{Base.DimOrInd}}) where T = _similar(arr,T,dims)
# Ambiguity resolution with Base
@inline Base.similar(arr::CircularArray, ::Type{T}, dims::Tuple{Int64,Vararg{Int64}}) where T = _similar(arr,T,dims)
# Ambiguity resolution with a type-pirating OffsetArrays method. See OffsetArrays issue #87.
# Ambiguity is triggered in the case similar(arr) where arr.data::OffsetArray.
using OffsetArrays: OffsetAxisKnownLength
@inline Base.similar(arr::CircularArray, ::Type{T}, dims::Tuple{OffsetAxisKnownLength, Vararg{OffsetAxisKnownLength}}) where T = _similar(arr,T,dims)

CircularVector(data::AbstractArray{T, 1}) where T = CircularVector{T}(data)
CircularVector(def::T, size::Int) where T = CircularVector{T}(fill(def, size))
Expand Down