<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/lib/prism/polyfill, 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] Use `method_defined?` instead of `instance_methods.include?`</title>
<updated>2025-11-14T13:47:49+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-11-14T01:51:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0e604623d855934c1f10b293b698f223b79c5c07'/>
<id>0e604623d855934c1f10b293b698f223b79c5c07</id>
<content type='text'>
While the latter creates an intermediate array of all method names
including all ancestors, the former just traverse the inheritance
chain and can stop if found once.

https://github.com/ruby/prism/commit/6da384dd0e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While the latter creates an intermediate array of all method names
including all ancestors, the former just traverse the inheritance
chain and can stop if found once.

https://github.com/ruby/prism/commit/6da384dd0e
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix warn polyfill when no uplevel is provided</title>
<updated>2025-09-15T11:03:12+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-09-15T06:39:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9299cf31b1607859daf89772b777f19f426bed80'/>
<id>9299cf31b1607859daf89772b777f19f426bed80</id>
<content type='text'>
An unspecified uplevel is not the same as an uplevel of 1:

```
$ irb
irb(main):001&gt; warn("foo")
foo
=&gt; nil
irb(main):002&gt; warn("foo", uplevel: 1)
/home/user/.rbenv/versions/2.7.8/lib/ruby/gems/2.7.0/gems/irb-1.14.0/lib/irb/workspace.rb:121: warning: foo
=&gt; nil
```

https://github.com/ruby/prism/commit/dcedd14357
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An unspecified uplevel is not the same as an uplevel of 1:

```
$ irb
irb(main):001&gt; warn("foo")
foo
=&gt; nil
irb(main):002&gt; warn("foo", uplevel: 1)
/home/user/.rbenv/versions/2.7.8/lib/ruby/gems/2.7.0/gems/irb-1.14.0/lib/irb/workspace.rb:121: warning: foo
=&gt; nil
```

https://github.com/ruby/prism/commit/dcedd14357
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator during string escaping with invalid utf-8</title>
<updated>2025-06-11T18:07:43+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-06-11T13:28:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=970813d98285b8f59fe5e4d3c815cc044926cb1b'/>
<id>970813d98285b8f59fe5e4d3c815cc044926cb1b</id>
<content type='text'>
Instead, prefer `scan_byte` over `get_byte` since that already returns the byte as an integer, sidestepping conversion issues.

Fixes https://github.com/ruby/prism/issues/3582

https://github.com/ruby/prism/commit/7f3008b2b5
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead, prefer `scan_byte` over `get_byte` since that already returns the byte as an integer, sidestepping conversion issues.

Fixes https://github.com/ruby/prism/issues/3582

https://github.com/ruby/prism/commit/7f3008b2b5
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Polyfill Kernel#warn category parameter</title>
<updated>2025-03-19T21:03:18+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2025-03-19T18:54:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=050ffab82b1a855d6b6edf5fbc6dc8c9311b6556'/>
<id>050ffab82b1a855d6b6edf5fbc6dc8c9311b6556</id>
<content type='text'>
https://github.com/ruby/prism/commit/d85c72a1b9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/d85c72a1b9
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator crash for certain octal escapes</title>
<updated>2025-03-18T17:36:53+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-01-19T12:38:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a679597547b23259159dd914959ca36409878199'/>
<id>a679597547b23259159dd914959ca36409878199</id>
<content type='text'>
`Integer#chr` performs some validation that we don't want/need. Octal escapes can go above 255, where it will then raise trying to convert.

`append_as_bytes` actually allows to pass a number, so we can just skip that call.
Although, on older rubies of course we still need to handle this in the polyfill.
I don't really like using `pack` but don't know of another way to do so.

For the utf-8 escapes, this is not an issue. Invalid utf-8 in these is simply a syntax error.

https://github.com/ruby/prism/commit/161c606b1f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`Integer#chr` performs some validation that we don't want/need. Octal escapes can go above 255, where it will then raise trying to convert.

`append_as_bytes` actually allows to pass a number, so we can just skip that call.
Although, on older rubies of course we still need to handle this in the polyfill.
I don't really like using `pack` but don't know of another way to do so.

For the utf-8 escapes, this is not an issue. Invalid utf-8 in these is simply a syntax error.

https://github.com/ruby/prism/commit/161c606b1f
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator when unescaping invalid utf8</title>
<updated>2025-03-18T17:36:53+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-01-12T19:08:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=705bd6fadbd5a784d2c0fd52138007404de6a5c2'/>
<id>705bd6fadbd5a784d2c0fd52138007404de6a5c2</id>
<content type='text'>
1. The string starts out as binary
2. `ち` is appended, forcing it back into utf-8
3. Some invalid byte sequences are tried to append

&gt; incompatible character encodings: UTF-8 and BINARY (ASCII-8BIT)

This makes use of my wish to use `append_as_bytes`. Unfortunatly that method is rather new
so it needs a fallback

https://github.com/ruby/prism/commit/e31e94a775
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. The string starts out as binary
2. `ち` is appended, forcing it back into utf-8
3. Some invalid byte sequences are tried to append

&gt; incompatible character encodings: UTF-8 and BINARY (ASCII-8BIT)

This makes use of my wish to use `append_as_bytes`. Unfortunatly that method is rather new
so it needs a fallback

https://github.com/ruby/prism/commit/e31e94a775
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Prism::Location#adjoin</title>
<updated>2024-05-03T19:14:03+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-05-03T18:58:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d4a6d0c17781821d967063613fab5992231a5158'/>
<id>d4a6d0c17781821d967063613fab5992231a5158</id>
<content type='text'>
https://github.com/ruby/prism/commit/a298db68e3
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/a298db68e3
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Remove need for Natalie patches</title>
<updated>2024-04-25T18:00:09+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-04-25T17:00:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b6489e9f62dae9e62a4f978e0cb1091ab13c274c'/>
<id>b6489e9f62dae9e62a4f978e0cb1091ab13c274c</id>
<content type='text'>
https://github.com/ruby/prism/commit/7fc7e13476
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/7fc7e13476
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Move polyfill to separate file to type-check it independently.</title>
<updated>2024-03-06T21:37:53+00:00</updated>
<author>
<name>Ufuk Kayserilioglu</name>
<email>ufuk.kayserilioglu@shopify.com</email>
</author>
<published>2024-03-06T19:36:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8d191a9f57fa6ff86f63c98e99be68ed86f3052c'/>
<id>8d191a9f57fa6ff86f63c98e99be68ed86f3052c</id>
<content type='text'>
https://github.com/ruby/prism/commit/2a583b041b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/2a583b041b
</pre>
</div>
</content>
</entry>
</feed>
