<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/prism/fixtures/it_assignment.txt, branch v4.0.4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/prism] Make `it = it` assign `nil` to match parse.y behavior [Bug #21139]</title>
<updated>2025-08-05T17:58:09+00:00</updated>
<author>
<name>S-H-GAMELINKS</name>
<email>gamelinks007@gmail.com</email>
</author>
<published>2025-07-21T02:00:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b482e3d7cd77c688ed0e38e1c95c1f0b2b205cd6'/>
<id>b482e3d7cd77c688ed0e38e1c95c1f0b2b205cd6</id>
<content type='text'>
Currently Prism returns `42` for code like this:
```ruby
42.tap { it = it; p it } # =&gt; 42
```

But parse.y returns `nil`:
```ruby
42.tap { it = it; p it } # =&gt; 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently Prism returns `42` for code like this:
```ruby
42.tap { it = it; p it } # =&gt; 42
```

But parse.y returns `nil`:
```ruby
42.tap { it = it; p it } # =&gt; 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
</pre>
</div>
</content>
</entry>
</feed>
