Skip to content

Commit

Permalink
Don't specialize Base._reshape (#374)
Browse files Browse the repository at this point in the history
* Don't specialize Base._reshape

* Restore downstream tests

---------

Co-authored-by: Sheehan Olver <[email protected]>
  • Loading branch information
jishnub and dlfivefifty authored Aug 20, 2024
1 parent 222bfd8 commit 9868632
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ jobs:
package:
- {repo: Distributions.jl, group: JuliaStats}
- {repo: BlockArrays.jl, group: JuliaArrays}
# - {repo: LazyArrays.jl, group: JuliaArrays}
- {repo: LazyArrays.jl, group: JuliaArrays}
- {repo: InfiniteArrays.jl, group: JuliaArrays}
- {repo: ArrayLayouts.jl, group: JuliaLinearAlgebra}
# - {repo: LazyBandedMatrices.jl, group: JuliaLinearAlgebra}
- {repo: LazyBandedMatrices.jl, group: JuliaLinearAlgebra}
- {repo: BandedMatrices.jl, group: JuliaLinearAlgebra}
- {repo: BlockBandedMatrices.jl, group: JuliaLinearAlgebra}
# - {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
- {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
- {repo: Optim.jl, group: JuliaNLSolvers}

steps:
Expand Down
9 changes: 2 additions & 7 deletions src/FillArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,12 @@ reshape(parent::AbstractFill, dims::Tuple{Vararg{Union{Int,Colon}}}) =
fill_reshape(parent, Base._reshape_uncolon(parent, dims)...)
reshape(parent::AbstractFill, shp::Tuple{Union{Integer,Base.OneTo}, Vararg{Union{Integer,Base.OneTo}}}) =
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)
reshape(parent::AbstractFill, dims::Dims) = fill_reshape(parent, dims...)
reshape(parent::AbstractFill, dims::Tuple{Integer, Vararg{Integer}}) = fill_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})`
Base._reshape(parent::AbstractFill{T, 1, Axes}, dims::Tuple{Int}) where {T, Axes} = fill_reshape(parent, dims...)

for (AbsTyp, Typ, funcs, func) in ((:AbstractZeros, :Zeros, :zeros, :zero), (:AbstractOnes, :Ones, :ones, :one))
@eval begin
abstract type $AbsTyp{T, N, Axes} <: AbstractFill{T, N, Axes} end
Expand Down

0 comments on commit 9868632

Please sign in to comment.