Skip to content

Commit

Permalink
Fix #127.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkeller34 committed Apr 19, 2018
1 parent 4489cfb commit beb7369
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ Base.promote_rule(::Type{Quantity{T}}, ::Type{Quantity{S,D,U}}) where {T,S,D,U}

Base.promote_rule(::Type{Quantity{S,D,U}}, ::Type{Quantity{T}}) where {T,S,D,U} =
Quantity{promote_type(T,S)}

@static if VERSION >= v"0.7.0-DEV.3591"
Base.promote_typejoin(::Type{T}, ::Type{Quantity{T,D,U}}) where {T,S,D,U} = Quantity{T}
end
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,9 @@ end
b = [0.0, 0.0m]
@test b + b == b
@test b .+ b == b

@static if VERSION >= v"0.7.0-DEV.3591"
@test eltype(b+b) === Quantity{Float64}
end
# Dimensionless quantities
@test @inferred([1mm/m] + [1.0cm/m]) == [0.011]
@test typeof([1mm/m] + [1.0cm/m]) == Array{Float64,1}
Expand Down

0 comments on commit beb7369

Please sign in to comment.