Skip to content

Commit 43f4afe

Browse files
authored
improve getproperty(Pairs) warnings (#55989)
- Only call `depwarn` if the field is `itr` or `data`; otherwise let the field error happen as normal - Give a more specific deprecation warning.
1 parent 7cc195c commit 43f4afe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

base/deprecated.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ const All16{T,N} = Tuple{T,T,T,T,T,T,T,T,
432432

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

0 commit comments

Comments
 (0)