diff options
| author | S-H-GAMELINKS <gamelinks007@gmail.com> | 2025-07-21 11:00:33 +0900 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2025-08-05 13:58:09 -0400 |
| commit | b482e3d7cd77c688ed0e38e1c95c1f0b2b205cd6 (patch) | |
| tree | 767ba8c44c2efe160096500e5c1d9b3e27d6dc8d /include/ruby | |
| parent | 6e2b139d6ac1bcbae26c06a4e3022e8b2be8307e (diff) | |
[ruby/prism] Make `it = it` assign `nil` to match parse.y behavior [Bug #21139]
Currently Prism returns `42` for code like this:
```ruby
42.tap { it = it; p it } # => 42
```
But parse.y returns `nil`:
```ruby
42.tap { it = it; p it } # => nil
```
In parse.y, it on the right-hand side is parsed as a local variable.
In Prism, it was parsed as the implicit block parameter it, which caused this inconsistent behavior.
This change makes the right-hand side it to be parsed as a local variable, aligning with parse.y's behavior.
Bug ticket: https://bugs.ruby-lang.org/issues/21139
https://github.com/ruby/prism/commit/cf3bbf9d2c
Diffstat (limited to 'include/ruby')
0 files changed, 0 insertions, 0 deletions
