Skip to content

Commit ae9c4f7

Browse files
authored
undeprecate constructor <--> convert pun for Dual (#347)
1 parent 466de85 commit ae9c4f7

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/dual.jl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,9 @@ end
4747
@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))
4848
@inline Dual(args...) = Dual{Nothing}(args...)
4949

50-
function Dual{T,V,N}(x::Real) where {T,V,N}
51-
Base.depwarn("Dual{$T,$V,$N}(x::Real) is deprecated, use `convert(Dual{$T,$V,$N}, x)` instead.", :Dual)
52-
return convert(Dual{T,V,N}, x)
53-
end
54-
55-
function Dual{T,V}(x::Real) where {T,V}
56-
Base.depwarn("Dual{$T,$V}(x::Real) is deprecated, use `convert(Dual{$T,$V}, x)` instead.", :Dual)
57-
return convert(Dual{T,V}, x)
58-
end
50+
# we define these special cases so that the "constructor <--> convert" pun holds for `Dual`
51+
@inline Dual{T,V,N}(x::Real) where {T,V,N} = convert(Dual{T,V,N}, x)
52+
@inline Dual{T,V}(x::Real) where {T,V} = convert(Dual{T,V}, x)
5953

6054
##############################
6155
# Utility/Accessor Functions #

0 commit comments

Comments
 (0)