Skip to content

Commit cf68133

Browse files
committed
Use StaticInteger instead of StaticInt
1 parent 5bba40f commit cf68133

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

src/MeasureBase.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const Pretty = PrettyPrinting
3434
using ChainRulesCore
3535
import FillArrays
3636
using Static
37+
using Static: StaticInteger
3738
using FunctionChains
3839

3940
export

src/density-core.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ end
143143
@generated function _logdensity_rel(
144144
μs::Tμ,
145145
νs::Tν,
146-
::Tuple{StaticInt{M},StaticInt{N}},
146+
::Tuple{<:StaticInteger{M},<:StaticInteger{N}},
147147
x::X,
148148
) where {Tμ,Tν,M,N,X}
149149
= schema(Tμ)

src/standard/stdmeasure.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ end
3434

3535
# Implement transport_to(NU::Type{<:StdMeasure}, μ) and transport_to(ν, MU::Type{<:StdMeasure}):
3636

37-
_std_measure(::Type{M}, ::StaticInt{1}) where {M<:StdMeasure} = M()
37+
_std_measure(::Type{M}, ::StaticInteger{1}) where {M<:StdMeasure} = M()
3838
_std_measure(::Type{M}, dof::IntegerLike) where {M<:StdMeasure} = M()^dof
3939
_std_measure_for(::Type{M}, μ::Any) where {M<:StdMeasure} = _std_measure(M, getdof(μ))
4040

src/static.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
MeasureBase.IntegerLike
33
4-
Equivalent to `Union{Integer,Static.StaticInt}`.
4+
Equivalent to `Union{Integer,Static.StaticInteger}`.
55
"""
6-
const IntegerLike = Union{Integer,Static.StaticInt}
6+
const IntegerLike = Union{Integer,Static.StaticInteger}
77

88
"""
99
MeasureBase.one_to(n::IntegerLike)
@@ -14,7 +14,7 @@ Returns an instance of `Base.OneTo` or `Static.SOneTo`, depending
1414
on the type of `n`.
1515
"""
1616
@inline one_to(n::Integer) = Base.OneTo(n)
17-
@inline one_to(::Static.StaticInt{N}) where {N} = Static.SOneTo{N}()
17+
@inline one_to(::Static.StaticInteger{N}) where {N} = Static.SOneTo{N}()
1818

1919
_dynamic(x::Number) = dynamic(x)
2020
_dynamic(::Static.SOneTo{N}) where {N} = Base.OneTo(N)
@@ -49,7 +49,7 @@ Returns the length of `x` as a dynamic or static integer.
4949
"""
5050
maybestatic_length(x) = length(x)
5151
maybestatic_length(x::AbstractUnitRange) = length(x)
52-
function maybestatic_length(::Static.OptionallyStaticUnitRange{StaticInt{A},StaticInt{B}}) where {A,B}
52+
function maybestatic_length(::Static.OptionallyStaticUnitRange{<:StaticInteger{A},<:StaticInteger{B}}) where {A,B}
5353
StaticInt{B - A + 1}()
5454
end
5555

src/transport.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ _origin_depth_pullback(ΔΩ) = NoTangent(), NoTangent()
139139
ChainRulesCore.rrule(::typeof(_origin_depth), ν) = _origin_depth(ν), _origin_depth_pullback
140140

141141
# If both both measures have no origin:
142-
function _transport_between_origins(ν, ::StaticInt{0}, ::StaticInt{0}, μ, x)
142+
function _transport_between_origins(ν, ::StaticInteger{0}, ::StaticInteger{0}, μ, x)
143143
_transport_with_intermediate(ν, _transport_intermediate(ν, μ), μ, x)
144144
end
145145

146146
@generated function _transport_between_origins(
147147
ν,
148-
::StaticInt{n_ν},
149-
::StaticInt{n_μ},
148+
::StaticInteger{n_ν},
149+
::StaticInteger{n_μ},
150150
μ,
151151
x,
152152
) where {n_ν,n_μ}
@@ -188,7 +188,7 @@ end
188188

189189
@inline _transport_intermediate(ν, μ) = _transport_intermediate(getdof(ν), getdof(μ))
190190
@inline _transport_intermediate(::Integer, n_μ::Integer) = StdUniform()^n_μ
191-
@inline _transport_intermediate(::StaticInt{1}, ::StaticInt{1}) = StdUniform()
191+
@inline _transport_intermediate(::StaticInteger{1}, ::StaticInteger{1}) = StdUniform()
192192

193193
_call_transport_def(ν, μ, x) = transport_def(ν, μ, x)
194194
_call_transport_def(::Any, ::Any, x::NoTransportOrigin) = x

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ repeatedly until there's no change. That's what this does.
3333
_rootmeasure(μ, static(n))
3434
end
3535

36-
@generated function _rootmeasure(μ, ::StaticInt{n}) where {n}
36+
@generated function _rootmeasure(μ, ::StaticInteger{n}) where {n}
3737
q = quote end
3838
foreach(1:n) do _
3939
push!(q.args, :(μ = basemeasure(μ)))

0 commit comments

Comments
 (0)