Skip to content

Commit

Permalink
remove deprecated promote_array_type (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels authored Jan 9, 2018
1 parent 97f881c commit ee80bbc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
5 changes: 0 additions & 5 deletions src/dual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,6 @@ Base.convert(::Type{Dual{T,V,N}}, d::Dual{T}) where {T,V<:Real,N} = Dual{T}(conv
Base.convert(::Type{Dual{T,V,N}}, x::Real) where {T,V<:Real,N} = Dual{T}(V(x), zero(Partials{N,V}))
Base.convert(::Type{D}, d::D) where {D<:Dual} = d

Base.promote_array_type(F, ::Type{D}, ::Type{A}) where {D<:Dual,A<:AbstractFloat} = promote_type(D, A)
Base.promote_array_type(F, ::Type{<:Dual}, ::Type{<:AbstractFloat}, ::Type{P}) where {P} = P
Base.promote_array_type(F, ::Type{A}, ::Type{D}) where {D<:Dual,A<:AbstractFloat} = promote_type(D, A)
Base.promote_array_type(F, ::Type{<:AbstractFloat}, ::Type{<:Dual}, ::Type{P}) where {P} = P

Base.float(d::Dual{T,V,N}) where {T,V,N} = Dual{T,promote_type(V, Float16),N}(d)
Base.AbstractFloat(d::Dual{T,V,N}) where {T,V,N} = Dual{T,promote_type(V, Float16),N}(d)

Expand Down
11 changes: 0 additions & 11 deletions test/DualTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,6 @@ for N in (0,3), M in (0,4), V in (Int, Float32)
@test convert(Dual{TestTag(),Dual{TestTag(),V,M},N}, FDNUM) === Dual{TestTag()}(Dual{TestTag(),V,M}(PRIMAL), convert(Partials{N,Dual{TestTag(),V,M}}, PARTIALS))
@test convert(Dual{TestTag(),Dual{TestTag(),WIDE_T,M},N}, FDNUM) === Dual{TestTag()}(Dual{TestTag(),WIDE_T,M}(PRIMAL), convert(Partials{N,Dual{TestTag(),WIDE_T,M}}, PARTIALS))

if V != Int
@test Base.promote_array_type(+, Dual{TestTag(),V,N}, V, Base.promote_op(+, Dual{TestTag(),V,N}, V)) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, Dual{TestTag(),Int,N}, V, Base.promote_op(+, Dual{TestTag(),Int,N}, V)) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, V, Dual{TestTag(),V,N}, Base.promote_op(+, V, Dual{TestTag(),V,N})) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, V, Dual{TestTag(),Int,N}, Base.promote_op(+, V, Dual{TestTag(),Int,N})) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, Dual{TestTag(),V,N}, V) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, Dual{TestTag(),Int,N}, V) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, V, Dual{TestTag(),V,N}) == Dual{TestTag(),V,N}
@test Base.promote_array_type(+, V, Dual{TestTag(),Int,N}) == Dual{TestTag(),V,N}
end

##############
# Arithmetic #
##############
Expand Down

0 comments on commit ee80bbc

Please sign in to comment.