Skip to content

Commit 4f2bf7f

Browse files
SeSodesasostock
andauthored
Loosen the type restrictions of unit(::Type{Missing,T})
As suggested by @sostock, do not only restrict the type of T to Number, but include FixedPeriod as well, to accommodate Dates-soecific code. Co-authored-by: Sebastian Stock <[email protected]>
1 parent 51e81a5 commit 4f2bf7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ true
143143
@inline unit(x::Number) = NoUnits
144144
@inline unit(x::Type{T}) where {T <: Number} = NoUnits
145145
@inline unit(x::Function) = NoUnits # Functions do not have units. Function values might.
146-
@inline unit(x::Type{Union{Missing, T}}) where { T <: Number } = unit(T) # Type restriction required here for T, or might result in infinite recursion.
146+
@inline unit(x::Type{Union{Missing, T}}) where {T <: Union{Number, FixedPeriod}} = unit(T) # Type restriction required here for T, or might result in infinite recursion.
147147
@inline unit(x::Type{Missing}) = missing
148148
@inline unit(x::Missing) = missing
149149

0 commit comments

Comments
 (0)