Skip to content
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FillArrays"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.12.6"
version = "0.12.7"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
7 changes: 1 addition & 6 deletions src/FillArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,7 @@ end
function +(a::Fill{T, 1}, b::AbstractRange) where {T}
size(a) ≠ size(b) && throw(DimensionMismatch("dimensions must match."))
Tout = promote_type(T, eltype(b))
return (a.value + first(b)):convert(Tout, step(b)):(a.value + last(b))
end
function +(a::Fill{T, 1}, b::UnitRange) where {T}
size(a) ≠ size(b) && throw(DimensionMismatch("dimensions must match."))
Tout = promote_type(T, eltype(b))
return (a.value + first(b)):(a.value + last(b))
return a.value .+ b
end
+(a::AbstractRange, b::AbstractFill) = b + a

Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,14 @@ end
@test_throws DimensionMismatch rnge .+ Zeros(5)
@test_throws DimensionMismatch rnge .- Zeros(5)
@test_throws DimensionMismatch Zeros(5) .+ rnge

@test Fill(2,10) + (1:10) isa UnitRange
@test (1:10) + Fill(2,10) isa UnitRange

f = Fill(1+im,10)
@test f + rnge isa AbstractRange
@test f + rnge == rnge + f
@test f + (1:10) isa AbstractRange
end

@testset "Special Zeros/Ones" begin
Expand Down