Skip to content

Commit

Permalink
Fix Vararg warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
oschulz committed Sep 9, 2024
1 parent 60b17fe commit dd2eaf5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/combinators/power.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end

# ToDo: Make rand return static arrays for statically-sized power measures.

function _cartidxs(axs::Tuple{Vararg{<:AbstractUnitRange,N}}) where {N}
function _cartidxs(axs::Tuple{Vararg{AbstractUnitRange,N}}) where {N}
CartesianIndices(map(_dynamic, axs))
end

Expand All @@ -49,16 +49,16 @@ function Base.rand(rng::AbstractRNG, ::Type{T}, d::PowerMeasure) where {T}
end
end

@inline _pm_axes(sz::Tuple{Vararg{<:IntegerLike,N}}) where {N} = map(one_to, sz)
@inline _pm_axes(axs::Tuple{Vararg{<:AbstractUnitRange,N}}) where {N} = axs
@inline _pm_axes(sz::Tuple{Vararg{IntegerLike,N}}) where {N} = map(one_to, sz)
@inline _pm_axes(axs::Tuple{Vararg{AbstractUnitRange,N}}) where {N} = axs

@inline function powermeasure(x::T, sz::Tuple{Vararg{<:Any,N}}) where {T,N}
@inline function powermeasure(x::T, sz::Tuple{Vararg{Any,N}}) where {T,N}
PowerMeasure(x, _pm_axes(sz))
end

marginals(d::PowerMeasure) = fill_with(d.parent, d.axes)

function Base.:^::AbstractMeasure, dims::Tuple{Vararg{<:AbstractArray,N}}) where {N}
function Base.:^::AbstractMeasure, dims::Tuple{Vararg{AbstractArray,N}}) where {N}
powermeasure(μ, dims)
end

Expand Down
2 changes: 1 addition & 1 deletion src/combinators/smart-constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ powermeasure(m::AbstractMeasure, ::Tuple{}) = m

function powermeasure(
μ::WeightedMeasure,
dims::Tuple{<:AbstractArray,Vararg{<:AbstractArray}},
dims::Tuple{<:AbstractArray,Vararg{AbstractArray}},
)
k = mapreduce(length, *, dims) * μ.logweight
return weightedmeasure(k, μ.base^dims)
Expand Down
4 changes: 2 additions & 2 deletions src/static.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Returns an instance of `FillArrays.Fill`.
"""
function fill_with end

@inline function fill_with(x::T, sz::Tuple{Vararg{<:IntegerLike,N}}) where {T,N}
@inline function fill_with(x::T, sz::Tuple{Vararg{IntegerLike,N}}) where {T,N}
fill_with(x, map(one_to, sz))
end

@inline function fill_with(x::T, axs::Tuple{Vararg{<:AbstractUnitRange,N}}) where {T,N}
@inline function fill_with(x::T, axs::Tuple{Vararg{AbstractUnitRange,N}}) where {T,N}
# While `FillArrays.Fill` (mostly?) works with axes that are static unit
# ranges, some operations that automatic differentiation requires do fail
# on such instances of `Fill` (e.g. `reshape` from dynamic to static size).
Expand Down

0 comments on commit dd2eaf5

Please sign in to comment.