File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -56,4 +56,19 @@ for T in (:Thunk, :InplaceableThunk)
5656end
5757
5858
59- Base. @deprecate InplaceableThunk (t:: Thunk , add!) InplaceableThunk (add!, t)
59+ Base. @deprecate InplaceableThunk (t:: Thunk , add!) InplaceableThunk (add!, t)
60+
61+ const CONVERT_DEPRECATION = " convert(::Type{T}, t::Tangent) is deprecated, use ChainRulesCore.backing(t) instead"
62+
63+ function Base. convert (:: Type{<:NamedTuple} , comp:: Tangent{<:Any, <:NamedTuple} )
64+ Base. depwarn (CONVERT_DEPRECATION, :convert )
65+ return backing (comp)
66+ end
67+ function Base. convert (:: Type{<:Tuple} , comp:: Tangent{<:Any, <:Tuple} )
68+ Base. depwarn (CONVERT_DEPRECATION, :convert )
69+ return backing (comp)
70+ end
71+ function Base. convert (:: Type{<:Dict} , comp:: Tangent{<:Dict, <:Dict} )
72+ Base. depwarn (CONVERT_DEPRECATION, :convert )
73+ return backing (comp)
74+ end
Original file line number Diff line number Diff line change @@ -68,10 +68,6 @@ function Base.show(io::IO, comp::Tangent{P}) where P
6868 end
6969end
7070
71- Base. convert (:: Type{<:NamedTuple} , comp:: Tangent{<:Any, <:NamedTuple} ) = backing (comp)
72- Base. convert (:: Type{<:Tuple} , comp:: Tangent{<:Any, <:Tuple} ) = backing (comp)
73- Base. convert (:: Type{<:Dict} , comp:: Tangent{<:Dict, <:Dict} ) = backing (comp)
74-
7571Base. getindex (comp:: Tangent , idx) = getindex (backing (comp), idx)
7672
7773# for Tuple
You can’t perform that action at this time.
0 commit comments