Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] committed Jun 25, 2018
1 parent d1982d4 commit d96eb4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/deprecated.jl
Expand Up @@ -2,31 +2,31 @@
# Config{N}(args...) --> Config(f, args..., Chunk{N}()) #
#########################################################

function (::Type{GradientConfig{N}})(x) where N
function GradientConfig{N}(x) where N
msg = "GradientConfig{N}(x) is deprecated; use GradientConfig(nothing, x, Chunk{N}()) instead."
Base.depwarn(msg, :GradientConfig)
return GradientConfig(nothing, x, Chunk{N}())
end

function (::Type{JacobianConfig{N}})(x) where N
function JacobianConfig{N}(x) where N
msg = "JacobianConfig{N}(x) is deprecated; use JacobianConfig(nothing, x, Chunk{N}()) instead."
Base.depwarn(msg, :JacobianConfig)
return JacobianConfig(nothing, x, Chunk{N}())
end

function (::Type{JacobianConfig{N}})(y, x) where N
function JacobianConfig{N}(y, x) where N
msg = "JacobianConfig{N}(y, x) is deprecated; use JacobianConfig(nothing, y, x, Chunk{N}()) instead."
Base.depwarn(msg, :JacobianConfig)
return JacobianConfig(nothing, y, x, Chunk{N}())
end

function (::Type{HessianConfig{N}})(x) where N
function HessianConfig{N}(x) where N
msg = "HessianConfig{N}(x) is deprecated; use HessianConfig(nothing, x, Chunk{N}()) instead."
Base.depwarn(msg, :HessianConfig)
return HessianConfig(nothing, x, Chunk{N}())
end

function (::Type{HessianConfig{N}})(out, x) where N
function HessianConfig{N}(out, x) where N
msg = "HessianConfig{N}(out, x) is deprecated; use HessianConfig(nothing, out, x, Chunk{N}()) instead."
Base.depwarn(msg, :HessianConfig)
return HessianConfig(nothing, out, x, Chunk{N}())
Expand Down
12 changes: 6 additions & 6 deletions src/dual.jl
Expand Up @@ -34,17 +34,17 @@ tag can be extracted, so it should be used in the _innermost_ function.
# Constructors #
################

@inline (::Type{Dual{T}})(value::V, partials::Partials{N,V}) where {T,N,V} = Dual{T,V,N}(value, partials)
@inline Dual{T}(value::V, partials::Partials{N,V}) where {T,N,V} = Dual{T,V,N}(value, partials)

@inline function (::Type{Dual{T}})(value::A, partials::Partials{N,B}) where {T,N,A,B}
@inline function Dual{T}(value::A, partials::Partials{N,B}) where {T,N,A,B}
C = promote_type(A, B)
return Dual{T}(convert(C, value), convert(Partials{N,C}, partials))
end

@inline (::Type{Dual{T}})(value::Real, partials::Tuple) where {T} = Dual{T}(value, Partials(partials))
@inline (::Type{Dual{T}})(value::Real, partials::Tuple{}) where {T} = Dual{T}(value, Partials{0,typeof(value)}(partials))
@inline (::Type{Dual{T}})(value::Real, partials::Real...) where {T} = Dual{T}(value, partials)
@inline (::Type{Dual{T}})(value::V, ::Chunk{N}, p::Val{i}) where {T,V<:Real,N,i} = Dual{T}(value, single_seed(Partials{N,V}, p))
@inline Dual{T}(value::Real, partials::Tuple) where {T} = Dual{T}(value, Partials(partials))
@inline Dual{T}(value::Real, partials::Tuple{}) where {T} = Dual{T}(value, Partials{0,typeof(value)}(partials))
@inline Dual{T}(value::Real, partials::Real...) where {T} = Dual{T}(value, partials)
@inline Dual{T}(value::V, ::Chunk{N}, p::Val{i}) where {T,V<:Real,N,i} = Dual{T}(value, single_seed(Partials{N,V}, p))

@inline Dual(args...) = Dual{Nothing}(args...)

Expand Down

0 comments on commit d96eb4c

Please sign in to comment.