Skip to content

Commit

Permalink
Merge pull request #295 from JeffBezanson/master
Browse files Browse the repository at this point in the history
fix use of `.primary` field for jb/subtype
  • Loading branch information
JeffBezanson authored Dec 29, 2016
2 parents 6d60600 + 638ec83 commit 8c6b04c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1158,12 +1158,21 @@ if !isdefined(Base, :istextmime)
istextmime(m::@compat(Union{MIME,AbstractString})) = istext(m)
end

function primarytype(t::ANY)
tn = t.name
if isdefined(tn, :primary)
return tn.primary
else
return tn.wrapper
end
end

export @functorize
macro functorize(f)
if VERSION >= v"0.5.0-dev+3701"
f === :scalarmax ? :(Base.scalarmax) :
f === :scalarmin ? :(Base.scalarmin) :
f === :centralizedabs2fun ? :(typeof(Base.centralizedabs2fun(0)).name.primary) :
f === :centralizedabs2fun ? :(primarytype(typeof(Base.centralizedabs2fun(0)))) :
f
else
f = f === :identity ? :(Base.IdFun()) :
Expand Down

0 comments on commit 8c6b04c

Please sign in to comment.