Skip to content

Commit cf1972f

Browse files
authored
Fix broadcaststyle for 0d FillArray (#217)
1 parent 7a46d08 commit cf1972f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/infarrays.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ end
167167
# Lazy Broadcasting
168168
for typ in (:Ones, :Zeros, :Fill)
169169
@eval begin
170-
BroadcastStyle(::Type{$typ{T,N,NTuple{N,<:OneToInf}}}) where {T,N} = LazyArrayStyle{N}()
170+
BroadcastStyle(::Type{$typ{T,N,<:Tuple{OneToInf,Vararg{OneToInf}}}}) where {T,N} = LazyArrayStyle{N}()
171171
BroadcastStyle(::Type{$typ{T,2,<:Tuple{<:Any,<:OneToInf}}}) where {T} = LazyArrayStyle{2}()
172172
BroadcastStyle(::Type{$typ{T,2,<:Tuple{<:OneToInf,<:Any}}}) where {T} = LazyArrayStyle{2}()
173173
end
@@ -430,4 +430,4 @@ LazyArrays.cache_getindex(::InfiniteCardinal{0}, A::AbstractVector, I, J...) = l
430430
LazyArrays.cache_getindex(::InfiniteCardinal{0}, A::CachedVector{<:Any,<:AbstractVector,<:AbstractFill{<:Any,1}}, I::AbstractVector) = LazyArrays.cache_getindex(nothing, A, I)
431431

432432

433-
*(a::AbstractVector, b::AbstractFill{<:Any,2,Tuple{OneTo{Int},OneToInf{Int}}}) = ApplyArray(*,a,b)
433+
*(a::AbstractVector, b::AbstractFill{<:Any,2,Tuple{OneTo{Int},OneToInf{Int}}}) = ApplyArray(*,a,b)

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,8 @@ end
884884
@test broadcast(*, 1:∞, Fill(2,∞)') isa BroadcastArray
885885
@test broadcast(*, Diagonal(1:∞), Ones{Int}(∞)') broadcast(*, Ones{Int}(∞)', Diagonal(1:∞)) Diagonal(1:∞)
886886
@test broadcast(*, Diagonal(1:∞), Fill(2,∞)') broadcast(*, Fill(2,∞)', Diagonal(1:∞)) Diagonal(2:2:∞)
887+
888+
@test !(Broadcast.BroadcastStyle(typeof(Fill(4))) isa LazyArrayStyle)
887889
end
888890

889891
@testset "subview inf broadcast" begin

0 commit comments

Comments
 (0)