Skip to content

Commit bcfaf34

Browse files
authored
Refactor promotion in measurement
1 parent f11cfc4 commit bcfaf34

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ext/DynamicQuantitiesMeasurementsExt.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ function Measurements.measurement(a::Q, b::Q) where {Q<:AbstractQuantity}
88
raw_measurement = measurement(ustrip(a), ustrip(b))
99
return new_quantity(Q, raw_measurement, dimension(a))
1010
end
11-
function Measurements.measurement(a::Q1, b::Q2) where {Q1<:AbstractQuantity, Q2<:AbstractQuantity}
12-
Q = promote_type(Q1, Q2)
13-
a = convert(Q, a)
14-
b = convert(Q, b)
15-
return measurement(a, b)
11+
function Measurements.measurement(a::AbstractQuantity, b::AbstractQuantity)
12+
return measurement(promote(a, b)...)
1613
end
1714

1815
Measurements.value(q::Q) where {Q<:AbstractQuantity} = new_quantity(Q, value(ustrip(q)), dimension(q))

0 commit comments

Comments
 (0)