Skip to content

Commit

Permalink
Merge pull request #89 from vtjnash/patch-1
Browse files Browse the repository at this point in the history
avoid dependency on promote being marked pure
  • Loading branch information
ajkeller34 authored Jun 6, 2017
2 parents 1164e20 + 9a8dd68 commit ef27338
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function Base.promote_rule{S1,S2,D,U1,U2}(::Type{Quantity{S1,D,U1}},

p = promote_unit(U1(), U2())
numtype = promote_type(S1,S2,
typeof(convfact(p,U1())), typeof(convfact(p,U2())))
promote_type(typeof(convfact(p,U1())), typeof(convfact(p,U2()))))
if !isunitless(p)
if U1 <: ContextUnits && U2 <: ContextUnits
up1 = upreferred(U1())
Expand Down
3 changes: 2 additions & 1 deletion src/Unitful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const promotion = Dict{Symbol,Unit}()
include("User.jl")
const NoUnits = FreeUnits{(), Dimensions{()}}()
const NoDims = Dimensions{()}()
@inline isunitless{N}(::Units{N}) = N == ()
isunitless(::Units) = false
isunitless(::Units{()}) = true

(y::FreeUnits)(x::Number) = uconvert(y,x)
(y::ContextUnits)(x::Number) = uconvert(y,x)
Expand Down

0 comments on commit ef27338

Please sign in to comment.