Skip to content

Commit c230a6a

Browse files
committed
Fully qualify Dates.FixedPeriod in type restriction of method unit(x::Type{Union{Missing, T}}) and remove unwanted unit methods
Now the tests run again. Still need to revert the tests that were converted from throwing MethodError to outputting NoUnits.
1 parent 4f2bf7f commit c230a6a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/utils.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,9 @@ julia> unit(1.0) == NoUnits
139139
true
140140
```
141141
"""
142-
@inline unit(x::Any) = NoUnits # In general, things do not have units.
143142
@inline unit(x::Number) = NoUnits
144143
@inline unit(x::Type{T}) where {T <: Number} = NoUnits
145-
@inline unit(x::Function) = NoUnits # Functions do not have units. Function values might.
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.
144+
@inline unit(x::Type{Union{Missing, T}}) where {T <: Union{Number, Dates.FixedPeriod}} = unit(T) # Type restriction required here for T, or might result in infinite recursion.
147145
@inline unit(x::Type{Missing}) = missing
148146
@inline unit(x::Missing) = missing
149147

0 commit comments

Comments
 (0)