diff --git a/src/range.jl b/src/range.jl index 1fb3c6a0..467ed1d9 100644 --- a/src/range.jl +++ b/src/range.jl @@ -44,6 +44,7 @@ _colon{T}(::Any, ::Any, start::T, step, stop::T) = # Opt into TwicePrecision functionality *(x::Base.TwicePrecision, y::Units) = Base.TwicePrecision(x.hi*y, x.lo*y) +*(x::Base.TwicePrecision, y::Quantity) = (x * ustrip(y)) * unit(y) function colon(start::T, step::T, stop::T) where (T<:Quantity{S} where S<:Union{Float16,Float32,Float64}) # This will always return a StepRangeLen diff --git a/test/runtests.jl b/test/runtests.jl index 512bc17b..ed91ae21 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -892,6 +892,10 @@ end @test @inferred((1:5)*mm) === 1mm:1mm:5mm @test @inferred((1:2:5)*mm) === 1mm:2mm:5mm @test @inferred((1.0:2.0:5.01)*mm) === 1.0mm:2.0mm:5.0mm + r = @inferred(range(0.1, 0.1, 3) * 1.0s) + if VERSION >= v"0.6.0-pre" + @test r[3] === 0.3s + end end end @testset "> Arrays" begin