Actions
Bug #18405
closedRegression in Struct member setter method parameters
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-12-08T10:11:02Z master 3021c3cedc) [x86_64-darwin21]
Description
Since the PR optimizing Struct accessors was merged, the behaviour of Method#parameters
on Struct member setter methods has changed.
Before:
S = Struct.new(:foo)
S.instance_method(:foo=).parameters
#=> [[:req, :_]]
After:
S = Struct.new(:foo)
S.instance_method(:foo=).parameters
#=> [[:rest]]
This is probably a side-effect of the new optimized accessor implementation that was missed in review.
If this change in behaviour was intentional, though, I think it should be fixed, since it is a little strange for a setter method to claim that it takes zero or more parameters.
Actions
Like0
Like0Like0Like0