From 4c71936bfeee6878ea5450c4ab37d7d3fd1e27a8 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sat, 7 Dec 2024 16:27:09 +0530 Subject: [PATCH] Fewer `reshape` methods on julia v1.12 --- src/FillArrays.jl | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/FillArrays.jl b/src/FillArrays.jl index 66dad480..35788bb1 100644 --- a/src/FillArrays.jl +++ b/src/FillArrays.jl @@ -272,23 +272,24 @@ function fill_reshape(parent, dims::Integer...) fillsimilar(parent, dims...) 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)...) -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)) +if VERSION < v"1.12.0-DEV.1726" + # resolve ambiguity with Base + reshape(parent::AbstractFillVector, ::Colon) = parent + 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) + reshape(parent::AbstractFill, dims::Tuple{Vararg{Union{Integer,Colon}}}) = + fill_reshape(parent, Base._reshape_uncolon(parent, dims)...) + 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)) + # resolve ambiguity with Base + reshape(parent::AbstractFillVector, ::Tuple{Colon}) = parent +end 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 for (AbsTyp, Typ, funcs, func) in ((:AbstractZeros, :Zeros, :zeros, :zero), (:AbstractOnes, :Ones, :ones, :one)) @eval begin