Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On 2021-11-08, I merged rakudo/rakudo#4536, which corrected Rakudo's handling of re-binding to better fit the behavior described in S02, S06, and S07 (see that issue for background). At that time, @vrurg suggested moving the accompanying tests into Roast. However, @raiph had previously +1ed the PR "provided roast isn't being changed" (emphasis added). Since we didn't seem to have full consensus, I held off on adding any tests to Roast.
Having lived with the fixed semantics in Rakudo for a few releases now without apparent issue, I'm proposing this PR, which moves the re-binding tests from Rakudo into Roast, thereby specifying when variables can and cannot be rebound.
Here's a description of the behavior specified by these tests (though, of course, the tests themselves, not this description, are what would become the spec):
is copy
oris rw
For the above "declared as part of a Signature" covers two cases:
sub f($a, $b) { }
:=
's LHS in a variable declaration (see S02, spec'ed in S02-names-vars/signature.t:my ($a, $b) := (42, 47);