Skip to content

Commit

Permalink
Fixed a typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexatos committed Sep 7, 2021
1 parent 8fc82ef commit 3f99038
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CircularArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ end
@inline _similar(::Type{CircularArray{T,N,A}}, dims) where {T,N,A} = CircularArray{T,N}(similar(A, dims))
@inline Base.similar(CA::Type{CircularArray{T,N,A}}, dims::Tuple{Base.DimOrInd, Vararg{Base.DimOrInd}}) where {T,N,A} = _similar(CA, dims)
# Ambiguity resolution with Base
@inline Base.similar(CA::Type{CircularArray{T,N,A}}, dims::Dims) where {T,N,A} = _similar(CA, T, dims)
@inline Base.similar(CA::Type{CircularArray{T,N,A}}, dims::Dims) where {T,N,A} = _similar(CA, dims)
@inline Base.similar(CA::Type{CircularArray{T,N,A}}, dims::Tuple{Union{Integer, Base.OneTo}, Vararg{Union{Integer, Base.OneTo}}}) where {T,N,A} = _similar(CA, dims)

@inline Broadcast.BroadcastStyle(::Type{CircularArray{T,N,A}}) where {T,N,A} = Broadcast.ArrayStyle{CircularArray{T,N,A}}()
@inline Base.similar(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{CircularArray{T,N,A}}}, ::Type{ElType}, dims=axes(bc)) where {T,N,A,ElType} = CircularArray(similar(convert(Broadcast.Broadcasted{typeof(Broadcast.BroadcastStyle(A))}, bc), ElType, dims))
@inline Base.similar(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{CircularArray{T,N,A}}}, ::Type{ElType}) where {T,N,A,ElType} = CircularArray(similar(convert(Broadcast.Broadcasted{typeof(Broadcast.BroadcastStyle(A))}, bc), ElType))

@inline Base.dataids(arr::CircularArray) = Base.dataids(parent(arr))

Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ end
@test v3 isa CircularVector{Int64}
@test v3 == CircularArray([2, 3, 4, 5])
@test similar(v3, Base.OneTo(4)) isa typeof(v3)
@test similar(typeof(v3), Base.OneTo(4)) isa typeof(v3)
@test similar(typeof(v3), 4) isa typeof(v3)

v4 = @inferred(CircularArray([1, 2, 3, 4]) .+ 1)
@test v4 isa CircularVector{Int64}
Expand Down

0 comments on commit 3f99038

Please sign in to comment.