Skip to content

Commit 8e2d672

Browse files
authored
Fix #85 (#89)
1 parent 6271263 commit 8e2d672

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ os:
55
- osx
66
julia:
77
- 1.0
8-
- 1.1
9-
- 1.2
10-
- 1.3
118
- 1.4
129
- nightly
1310
matrix:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FillArrays"
22
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
3-
version = "0.8.5"
3+
version = "0.8.6"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

appveyor.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
environment:
22
matrix:
33
- julia_version: 1
4-
- julia_version: 1.1
5-
- julia_version: 1.2
6-
- julia_version: 1.3
74
- julia_version: 1.4
85
- julia_version: nightly
96

src/FillArrays.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,20 @@ function fill_reshape(parent, dims::Integer...)
165165
Fill(getindex_value(parent), dims...)
166166
end
167167

168-
reshape(parent::AbstractFill, dims::Integer...) = fill_reshape(parent, dims...)
169-
reshape(parent::AbstractFill, dims::Int...) = fill_reshape(parent, dims...)
168+
reshape(parent::AbstractFill, dims::Integer...) = reshape(parent, dims)
169+
reshape(parent::AbstractFill, dims::Union{Int,Colon}...) = reshape(parent, dims)
170+
reshape(parent::AbstractFill, dims::Union{Integer,Colon}...) = reshape(parent, dims)
171+
172+
reshape(parent::AbstractFill, dims::Tuple{Vararg{Union{Integer,Colon}}}) =
173+
fill_reshape(parent, Base._reshape_uncolon(parent, dims)...)
174+
reshape(parent::AbstractFill, dims::Tuple{Vararg{Union{Int,Colon}}}) =
175+
fill_reshape(parent, Base._reshape_uncolon(parent, dims)...)
176+
reshape(parent::AbstractFill, shp::Tuple{Union{Integer,Base.OneTo}, Vararg{Union{Integer,Base.OneTo}}}) =
177+
reshape(parent, Base.to_shape(shp))
178+
reshape(parent::AbstractFill, dims::Dims) = Base._reshape(parent, dims)
179+
reshape(parent::AbstractFill, dims::Tuple{Integer, Vararg{Integer}}) = Base._reshape(parent, dims)
180+
Base._reshape(parent::AbstractFill, dims::Dims) = fill_reshape(parent, dims...)
181+
Base._reshape(parent::AbstractFill, dims::Tuple{Integer,Vararg{Integer}}) = fill_reshape(parent, dims...)
170182

171183
for (Typ, funcs, func) in ((:Zeros, :zeros, :zero), (:Ones, :ones, :one))
172184
@eval begin

test/runtests.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,11 @@ end
943943
end
944944

945945
@testset "reshape" begin
946-
@test reshape(Fill(2,6),2,3) Fill(2,2,3)
947-
@test reshape(Fill(2,6),big(2),3) == Fill(2,big(2),3)
946+
@test reshape(Fill(2,6),2,3) reshape(Fill(2,6),(2,3)) reshape(Fill(2,6),:,3) reshape(Fill(2,6),2,:) Fill(2,2,3)
947+
@test reshape(Fill(2,6),big(2),3) == reshape(Fill(2,6), (big(2),3)) == reshape(Fill(2,6), big(2),:) == Fill(2,big(2),3)
948948
@test_throws DimensionMismatch reshape(Fill(2,6),2,4)
949+
@test reshape(Ones(6),2,3) reshape(Ones(6),(2,3)) reshape(Ones(6),:,3) reshape(Ones(6),2,:) Ones(2,3)
949950
@test reshape(Zeros(6),2,3) Zeros(2,3)
950951
@test reshape(Zeros(6),big(2),3) == Zeros(big(2),3)
952+
@test reshape(Fill(2,2,3),Val(1)) Fill(2,6)
951953
end

0 commit comments

Comments
 (0)