diff --git a/src/FillArrays.jl b/src/FillArrays.jl index d6d21f67..3e54ba86 100644 --- a/src/FillArrays.jl +++ b/src/FillArrays.jl @@ -264,6 +264,8 @@ end reshape(parent::AbstractFill, dims::Integer...) = reshape(parent, dims) reshape(parent::AbstractFill, dims::Union{Int,Colon}...) = reshape(parent, dims) reshape(parent::AbstractFill, dims::Union{Integer,Colon}...) = reshape(parent, dims) +# resolve ambiguity with Base +reshape(parent::AbstractFillVector, dims::Colon) = parent reshape(parent::AbstractFill, dims::Tuple{Vararg{Union{Integer,Colon}}}) = fill_reshape(parent, Base._reshape_uncolon(parent, dims)...) @@ -273,6 +275,10 @@ reshape(parent::AbstractFill, shp::Tuple{Union{Integer,Base.OneTo}, Vararg{Union reshape(parent, Base.to_shape(shp)) reshape(parent::AbstractFill, dims::Dims) = Base._reshape(parent, dims) reshape(parent::AbstractFill, dims::Tuple{Integer, Vararg{Integer}}) = Base._reshape(parent, dims) + +# resolve ambiguity with Base +reshape(parent::AbstractFillVector, dims::Tuple{Colon}) = parent + Base._reshape(parent::AbstractFill, dims::Dims) = fill_reshape(parent, dims...) Base._reshape(parent::AbstractFill, dims::Tuple{Integer,Vararg{Integer}}) = fill_reshape(parent, dims...) # Resolves ambiguity error with `_reshape(v::AbstractArray{T, 1}, dims::Tuple{Int})` diff --git a/test/runtests.jl b/test/runtests.jl index ef9f463c..c1efcf8c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1761,6 +1761,8 @@ end @test reshape(Zeros(6),big(2),3) == Zeros(big(2),3) @test reshape(Fill(2,2,3),Val(1)) ≡ Fill(2,6) @test reshape(Fill(2, 2), (2, )) ≡ Fill(2, 2) + + @test reshape(Fill(2,3), :) === reshape(Fill(2,3), (:,)) === Fill(2,3) end @testset "lmul!/rmul!" begin