Skip to content

Commit

Permalink
Merge pull request #8 from yha/no-offset-ambiguity-resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexatos authored Nov 16, 2020
2 parents 2fd9f4b + dfa4db9 commit fee589b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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

0 comments on commit fee589b

Please sign in to comment.