Skip to content

Commit

Permalink
improve getproperty(Pairs) warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin authored Oct 4, 2024
1 parent 7986e17 commit 48e255d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,13 @@ 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)
if s == :data
depwarn("use values(kwargs) instead of kwargs.data", :getproperty, force=true)
elseif s == :itr
depwarn("use keys(kwargs) instead of kwargs.itr", :getproperty, force=true)
else
depwarn("use NamedTuple(kwargs).$s instead of kwargs.$s", :getproperty, force=true)
end
return getfield(x, s)
end

Expand Down

0 comments on commit 48e255d

Please sign in to comment.