4747# Assorted calls found by Aqua: ################################################
4848# ###############################################################################
4949
50- function Complex (q:: AbstractRealQuantity )
51- @assert iszero (dimension (q)) " $(typeof (q)) : $(q) has dimensions! Use `ustrip` instead."
52- return Complex (ustrip (q))
53- end
54- function Complex {T} (q:: AbstractRealQuantity ) where {T<: Real }
55- @assert iszero (dimension (q)) " $(typeof (q)) : $(q) has dimensions! Use `ustrip` instead."
56- return Complex {T} (ustrip (q))
57- end
58- function Bool (q:: AbstractRealQuantity )
59- @assert iszero (dimension (q)) " $(typeof (q)) : $(q) has dimensions! Use `ustrip` instead."
60- return Bool (ustrip (q))
61- end
6250for type in (Signed, Float64, Float32, Rational), op in (:flipsign , :copysign )
6351 @eval function Base. $ (op)(x:: $type , y:: AbstractRealQuantity )
6452 return $ (op)(x, ustrip (y))
@@ -72,8 +60,16 @@ for type in (Complex, Complex{Bool})
7260 function Base.:* (l:: AbstractRealQuantity , r:: $type )
7361 new_quantity (typeof (l), ustrip (l) * r, dimension (l))
7462 end
63+ function $type (q:: AbstractRealQuantity ) where {T<: Real }
64+ @assert iszero (dimension (q)) " $(typeof (q)) : $(q) has dimensions! Use `ustrip` instead."
65+ return $ type (ustrip (q))
66+ end
7567 end
7668end
69+ function Bool (q:: AbstractRealQuantity )
70+ @assert iszero (dimension (q)) " $(typeof (q)) : $(q) has dimensions! Use `ustrip` instead."
71+ return Bool (ustrip (q))
72+ end
7773function Base.:/ (l:: Complex , r:: AbstractRealQuantity )
7874 new_quantity (typeof (r), l / ustrip (r), inv (dimension (r)))
7975end
0 commit comments