Skip to content

Commit

Permalink
improve getproperty(Pairs) warnings (#55989)
Browse files Browse the repository at this point in the history
- Only call `depwarn` if the field is `itr` or `data`; otherwise let the field error happen as normal
- Give a more specific deprecation warning.
  • Loading branch information
aplavin authored Oct 6, 2024
1 parent 7cc195c commit 43f4afe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ const All16{T,N} = Tuple{T,T,T,T,T,T,T,T,

# the plan is to eventually overload getproperty to access entries of the dict
@noinline function getproperty(x::Pairs, s::Symbol)
depwarn("use values(kwargs) and keys(kwargs) instead of kwargs.data and kwargs.itr", :getproperty, force=true)
s == :data && depwarn("use values(kwargs) instead of kwargs.data", :getproperty, force=true)
s == :itr && depwarn("use keys(kwargs) instead of kwargs.itr", :getproperty, force=true)
return getfield(x, s)
end

Expand Down

0 comments on commit 43f4afe

Please sign in to comment.