Fix #4652: allow augmenting setters to choose parameter name - #4663
Fix #4652: allow augmenting setters to choose parameter name#4663Darkildo wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
eernstg
left a comment
There was a problem hiding this comment.
LGTM, but I do think it would be slightly better to not do this. ;-)
| type is the type of the variable. | ||
| declaration also implicitly defines a setter with a single required positional | ||
| parameter whose type is the type of the variable. The variable declaration does | ||
| not determine the name of that parameter. |
There was a problem hiding this comment.
I think you may have been OOO at the time, but the ability to use a parameter declaration whose name is specified as _ to mean "I don't care" was reintroduced with #4669 and #4670. It should not be necessary to introduce the notion of "does not determine the name" for a parameter declaration.
I don't think it actually creates any problems with the specification to rely on "does not determine the name", but it seems simpler to rely on the ability of _ to do the same thing, now that this feature has been restored.
This PR updates the augmentations specification so that the implicit setter
induced by a variable declaration no longer has a fixed parameter name
_.Previously, the spec said that for augmentation purposes a non-
finalvariable(or a
latevariable without an initializer) implicitly defines a setter with aparameter named
_. After the recent changes around_, this made itimpossible for an augmenting setter declaration to choose its own parameter
name.
This PR changes that wording so that the implicit setter is specified only in
terms of its shape and type:
This restores the intended ability for an augmenting setter declaration to use a
source-level parameter name such as: