diff --git a/src/common.jl b/src/common.jl index 5b1f1a3e0..8ddc610a6 100644 --- a/src/common.jl +++ b/src/common.jl @@ -22,8 +22,8 @@ const RealFP = Union{Float32, Float64} ## conversion from real to fp types -fptype{T<:Union{Float32,Bool,Int8,UInt8,Int16,UInt16}}(::Type{T}) = Float32 -fptype{T<:Union{Float64,Int32,UInt32,Int64,UInt64,Int128,UInt128}}(::Type{T}) = Float64 +fptype(::Type{T}) where {T<:Union{Float32,Bool,Int8,UInt8,Int16,UInt16}} = Float32 +fptype(::Type{T}) where {T<:Union{Float64,Int32,UInt32,Int64,UInt64,Int128,UInt128}} = Float64 fptype(::Type{Complex64}) = Complex64 fptype(::Type{Complex128}) = Complex128 diff --git a/src/hist.jl b/src/hist.jl index f2b34a04b..8ddc1123d 100644 --- a/src/hist.jl +++ b/src/hist.jl @@ -32,7 +32,7 @@ end # Need a generated function to promote edge types, because a simple # promote_type(map(eltype, h.edges)...) isn't type stable (tested # with Julia v0.5). -@generated function _promote_edge_types{N}(edges::NTuple{N,AbstractVector}) +@generated function _promote_edge_types(edges::NTuple{N,AbstractVector}) where N promote_type(map(eltype, edges.parameters)...) end