@@ -164,7 +164,7 @@ struct Quantity{T,D,U} <: AbstractQuantity{T,D,U}
164164end
165165
166166# Field-only constructor
167- Quantity {<:Any,D,U} (val) where {D,U} = Quantity {typeof(val),D,U} (val)
167+ Quantity {<:Any,D,U} (val:: Number ) where {D,U} = Quantity {typeof(val),D,U} (val)
168168
169169constructorof (:: Type{Unitful.Quantity{_,D,U}} ) where {_,D,U} =
170170 Unitful. Quantity{T,D,U} where T
@@ -249,7 +249,7 @@ field, `val::T`, and the log of the ratio `val/S` is taken. This type differs fr
249249"""
250250struct Level{L, S, T<: RealOrRealQuantity } <: LogScaled{L}
251251 val:: T
252- function Level {L,S,T} (x) where {L,S,T}
252+ function Level {L,S,T} (x:: Number ) where {L,S,T}
253253 S isa ReferenceQuantity || throw (DomainError (S, " Reference quantity must be real." ))
254254 dimension (S) != dimension (x) && throw (DimensionError (S,x))
255255 return new {L,S,T} (x)
@@ -266,8 +266,8 @@ For example, given a gain of `20dB`, we have `val===20`. This type differs from
266266"""
267267struct Gain{L, S, T<: Real } <: LogScaled{L}
268268 val:: T
269+ Gain {L, S, T} (x:: Number ) where {L,S,T<: Real } = new {L,S,T} (x)
269270end
270- Unitful. Gain {L, S, T} (x:: Unitful.Gain{L, S, T} ) where {L,S,T<: Real } = x # for ambiguity resolution
271271
272272"""
273273 struct MixedUnits{T<:LogScaled, U<:Units}
0 commit comments