<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_pattern_matching.rb, 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>Handle deeply nested capture variables syntax err</title>
<updated>2025-11-17T02:30:24+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2025-11-16T21:57:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8d0105824f1cf722c1319496ed903b6a18efdafe'/>
<id>8d0105824f1cf722c1319496ed903b6a18efdafe</id>
<content type='text'>
When there are nested capture variables inside of a pattern match
that has an alternation pattern, it is a syntax error. Currently it
only adds a syntax error when it is at the top level of the pattern.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When there are nested capture variables inside of a pattern match
that has an alternation pattern, it is a syntax error. Currently it
only adds a syntax error when it is at the top level of the pattern.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #21572] Syntax error at capture in alternation pattern</title>
<updated>2025-11-14T12:03:04+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-10-23T15:57:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f4b6a5191ceb0ed0cd7a3e3c8bab24cc0dd15736'/>
<id>f4b6a5191ceb0ed0cd7a3e3c8bab24cc0dd15736</id>
<content type='text'>
Should fail even with `-c` option.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Should fail even with `-c` option.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update ruby test for colon-style hash inspect</title>
<updated>2024-10-03T09:47:09+00:00</updated>
<author>
<name>tompng</name>
<email>tomoyapenguin@gmail.com</email>
</author>
<published>2024-06-07T15:23:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7237af75d2aa700454fbaba9bda7a9283413d903'/>
<id>7237af75d2aa700454fbaba9bda7a9283413d903</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix TestPatternMatching#test_deconstruct_keys test</title>
<updated>2024-05-14T06:43:28+00:00</updated>
<author>
<name>Andrew Konchin</name>
<email>andry.konchin@gmail.com</email>
</author>
<published>2024-05-10T09:28:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b60f09442a0220e2fc053de020fdc58b642f851e'/>
<id>b60f09442a0220e2fc053de020fdc58b642f851e</id>
<content type='text'>
Before the change `C.keys` returned keys captured in some previous test case that by chance captured `nil` value what made this test passed successfully. Now it returns keys captured in this test case.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before the change `C.keys` returned keys captured in some previous test case that by chance captured `nil` value what made this test passed successfully. Now it returns keys captured in this test case.
</pre>
</div>
</content>
</entry>
<entry>
<title>Support NODE_ONCE for pattern matching</title>
<updated>2024-03-04T03:33:00+00:00</updated>
<author>
<name>S-H-GAMELINKS</name>
<email>gamelinks007@gmail.com</email>
</author>
<published>2024-02-01T10:50:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2d8788e90cd535933c0f444112d465cffc4c71b1'/>
<id>2d8788e90cd535933c0f444112d465cffc4c71b1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Keep unused literal nodes</title>
<updated>2023-10-31T08:49:12+00:00</updated>
<author>
<name>yui-knk</name>
<email>spiketeika@gmail.com</email>
</author>
<published>2023-10-20T12:30:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=51149f335e4aea3465bd52a98f85351455bf320e'/>
<id>51149f335e4aea3465bd52a98f85351455bf320e</id>
<content type='text'>
For static analysis, it’s better to keep unused literal nodes.
If simply change `block_append` to fall through, both "unused literal ignored"
and "possibly useless use of a literal in void context" warnings
are shown for the same line. But it’s verbose then remove
"unused literal ignored" warning.

This kind of optimization is already implemented on compile.c.
`compile_block` calls `iseq_compile_each0` with `popped = 1` when NODE_BLOCK
has next.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For static analysis, it’s better to keep unused literal nodes.
If simply change `block_append` to fall through, both "unused literal ignored"
and "possibly useless use of a literal in void context" warnings
are shown for the same line. But it’s verbose then remove
"unused literal ignored" warning.

This kind of optimization is already implemented on compile.c.
`compile_block` calls `iseq_compile_each0` with `popped = 1` when NODE_BLOCK
has next.
</pre>
</div>
</content>
</entry>
<entry>
<title>Pattern matching has not been experimental</title>
<updated>2023-09-05T02:52:34+00:00</updated>
<author>
<name>yui-knk</name>
<email>spiketeika@gmail.com</email>
</author>
<published>2023-09-02T12:50:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4a90c934278a0b1de11389dbbc208ee044117119'/>
<id>4a90c934278a0b1de11389dbbc208ee044117119</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>skip if `DidYouMean.formatter=` is not defined</title>
<updated>2023-04-16T00:26:56+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2023-04-15T18:58:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=29e01c6f5f8901bdaab818dfd4699cfa2a86b8e6'/>
<id>29e01c6f5f8901bdaab818dfd4699cfa2a86b8e6</id>
<content type='text'>
ruby/test_default_gems.rb can define empty `DidYouMean` module
because of the following line (second require) in the
`lib/did_you_mean/did_you_mean.gemspec`:

```ruby
begin
  require_relative "lib/did_you_mean/version"
rescue LoadError # Fallback to load version file in ruby core repository
  require_relative "version"
end
```

It defines only `::DidYouMean::VERSION`.

However, in the `test/ruby/test_patten_matching.rb` assumes that
if `defined?(DidYouMean)` is true, then there is a method `DidYouMean.formatter=`
and this assumption fails all tests in `test/ruby/test_patten_matching.rb` if
there is only a `::DidYouMean::VERSION`.

To reproduce the failures, we need to repeat the following command:

`make test-all TESTS='-v ruby/test_default_gems.rb ruby/pattern_matching'`

(because the ruby/test_default_gems.rb should be run before the ruby/pattern_matching`)

This patch introduces more strict gurds.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ruby/test_default_gems.rb can define empty `DidYouMean` module
because of the following line (second require) in the
`lib/did_you_mean/did_you_mean.gemspec`:

```ruby
begin
  require_relative "lib/did_you_mean/version"
rescue LoadError # Fallback to load version file in ruby core repository
  require_relative "version"
end
```

It defines only `::DidYouMean::VERSION`.

However, in the `test/ruby/test_patten_matching.rb` assumes that
if `defined?(DidYouMean)` is true, then there is a method `DidYouMean.formatter=`
and this assumption fails all tests in `test/ruby/test_patten_matching.rb` if
there is only a `::DidYouMean::VERSION`.

To reproduce the failures, we need to repeat the following command:

`make test-all TESTS='-v ruby/test_default_gems.rb ruby/pattern_matching'`

(because the ruby/test_default_gems.rb should be run before the ruby/pattern_matching`)

This patch introduces more strict gurds.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19175] p_rest should be `assignable'</title>
<updated>2023-03-26T09:56:21+00:00</updated>
<author>
<name>Kazuki Tsujimoto</name>
<email>kazuki@callcc.net</email>
</author>
<published>2023-03-26T06:33:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6c0925ba7017efde6091e2ec4f1a6be268166696'/>
<id>6c0925ba7017efde6091e2ec4f1a6be268166696</id>
<content type='text'>
It should also check for duplicate names.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It should also check for duplicate names.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19195] Allow optional newlines before closing parenthesis</title>
<updated>2022-12-13T09:06:11+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-12-13T06:18:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=764da87ab02d30c578138bdb0f37e7c18f2d4371'/>
<id>764da87ab02d30c578138bdb0f37e7c18f2d4371</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
