<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_lambda.rb, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>test/ruby/test_lambda.rb: Remove "warning: assigned but unused variable"</title>
<updated>2021-04-04T06:26:09+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2021-04-04T06:26:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2fcae4f90ab08ae06c28c4aa0989ee06d97f0536'/>
<id>2fcae4f90ab08ae06c28c4aa0989ee06d97f0536</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix return from orphan Proc in lambda</title>
<updated>2021-04-02T00:25:33+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2021-04-01T17:28:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ecfa8dcdbaf60cbe878389439de9ac94bc82e034'/>
<id>ecfa8dcdbaf60cbe878389439de9ac94bc82e034</id>
<content type='text'>
A "return" statement in a Proc in a lambda like:
  `lambda{ proc{ return }.call }`
should return outer lambda block. However, the inner Proc can become
orphan Proc from the lambda block. This "return" escape outer-scope
like method, but this behavior was decieded as a bug.
[Bug #17105]

This patch raises LocalJumpError by checking the proc is orphan or
not from lambda blocks before escaping by "return".

Most of tests are written by Jeremy Evans
https://github.com/ruby/ruby/pull/4223
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A "return" statement in a Proc in a lambda like:
  `lambda{ proc{ return }.call }`
should return outer lambda block. However, the inner Proc can become
orphan Proc from the lambda block. This "return" escape outer-scope
like method, but this behavior was decieded as a bug.
[Bug #17105]

This patch raises LocalJumpError by checking the proc is orphan or
not from lambda blocks before escaping by "return".

Most of tests are written by Jeremy Evans
https://github.com/ruby/ruby/pull/4223
</pre>
</div>
</content>
</entry>
<entry>
<title>test/ruby/test_lambda.rb: prevent lambda(&amp;proc_block) warnings</title>
<updated>2020-12-12T14:11:47+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2020-12-12T14:11:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=efbef729b2aee13241e6f7606f90d407f4530df8'/>
<id>efbef729b2aee13241e6f7606f90d407f4530df8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Disable deprecation warning by the default [Feature #16345]</title>
<updated>2020-09-25T00:50:33+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2020-08-31T05:58:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=996af2ce086249e904b2ce95ab2fcd1de7d757be'/>
<id>996af2ce086249e904b2ce95ab2fcd1de7d757be</id>
<content type='text'>
And `-w` option turns it on.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
And `-w` option turns it on.
</pre>
</div>
</content>
</entry>
<entry>
<title>Warn when passing a non-literal block to Kernel#lambda</title>
<updated>2020-06-11T14:30:48+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2020-06-11T00:50:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2188d6d160d3ba82432c87277310a4d417e136d5'/>
<id>2188d6d160d3ba82432c87277310a4d417e136d5</id>
<content type='text'>
Implements [Feature #15973]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implements [Feature #15973]
</pre>
</div>
</content>
</entry>
<entry>
<title>Kernel#lambda: return forwarded block as non-lambda proc</title>
<updated>2019-12-21T14:08:52+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2019-07-13T16:04:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=85a337f986fe6da99c7f8358f790f17b122b3903'/>
<id>85a337f986fe6da99c7f8358f790f17b122b3903</id>
<content type='text'>
Before this commit, Kernel#lambda can't tell the difference between a
directly passed literal block and one passed with an ampersand.

A block passed with an ampersand is semantically speaking already a
non-lambda proc. When Kernel#lambda receives a non-lambda proc, it
should simply return it.

Implementation wise, when the VM calls a method with a literal block, it
places the code for the block on the calling control frame and passes a
pointer (block handler) to the callee. Before this commit, the VM
forwards block arguments by simply forwarding the block handler, which
leaves the slot for block code unused when a control frame forwards its
block argument. I use the vacant space to indicate that a frame has
forwarded its block argument and inspect that in Kernel#lambda to detect
forwarded blocks.

This is a very ad-hoc solution and relies *heavily* on the way block
passing works in the VM. However, it's the most self-contained solution
I have.

[Bug #15620]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, Kernel#lambda can't tell the difference between a
directly passed literal block and one passed with an ampersand.

A block passed with an ampersand is semantically speaking already a
non-lambda proc. When Kernel#lambda receives a non-lambda proc, it
should simply return it.

Implementation wise, when the VM calls a method with a literal block, it
places the code for the block on the calling control frame and passes a
pointer (block handler) to the callee. Before this commit, the VM
forwards block arguments by simply forwarding the block handler, which
leaves the slot for block code unused when a control frame forwards its
block argument. I use the vacant space to indicate that a frame has
forwarded its block argument and inspect that in Kernel#lambda to detect
forwarded blocks.

This is a very ad-hoc solution and relies *heavily* on the way block
passing works in the VM. However, it's the most self-contained solution
I have.

[Bug #15620]
</pre>
</div>
</content>
</entry>
<entry>
<title>add tests for orphan/not-orphan proc/lambda.</title>
<updated>2019-07-15T05:17:27+00:00</updated>
<author>
<name>Tanaka Akira</name>
<email>akr@fsij.org</email>
</author>
<published>2019-07-15T05:17:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e4c1b199961cc5fa34c02b2225bbc14b75259fd2'/>
<id>e4c1b199961cc5fa34c02b2225bbc14b75259fd2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>add tests for "break" in lambda.</title>
<updated>2019-07-15T03:59:53+00:00</updated>
<author>
<name>Tanaka Akira</name>
<email>akr@fsij.org</email>
</author>
<published>2019-07-15T03:59:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bd494ae79b18e260b0123bf40ddc1c694d7b25b8'/>
<id>bd494ae79b18e260b0123bf40ddc1c694d7b25b8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>vm_args.c: arity check of lambda</title>
<updated>2017-03-19T01:11:12+00:00</updated>
<author>
<name>nobu</name>
<email>nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-03-19T01:11:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=976becf7eb18aa1592c703ac4d86a2cf9dfa701e'/>
<id>976becf7eb18aa1592c703ac4d86a2cf9dfa701e</id>
<content type='text'>
* vm_eval.c (rb_yield_lambda): new function which yields an array
  to a proc and splat to a lambda.  mainly for Enumerable only.

* vm_args.c (setup_parameters_complex): remove special lambda
  splatting for [Bug #9605].  [ruby-core:77065] [Bug #12705]

* vm_insnhelper.c (vm_callee_setup_block_arg): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* vm_eval.c (rb_yield_lambda): new function which yields an array
  to a proc and splat to a lambda.  mainly for Enumerable only.

* vm_args.c (setup_parameters_complex): remove special lambda
  splatting for [Bug #9605].  [ruby-core:77065] [Bug #12705]

* vm_insnhelper.c (vm_callee_setup_block_arg): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
<entry>
<title>test_lambda.rb: remove duplcate tests</title>
<updated>2017-03-18T15:58:13+00:00</updated>
<author>
<name>nobu</name>
<email>nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e</email>
</author>
<published>2017-03-18T15:58:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a9d575e507e1ce181ed71b9a7d4c3ad4f2f23e59'/>
<id>a9d575e507e1ce181ed71b9a7d4c3ad4f2f23e59</id>
<content type='text'>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
</pre>
</div>
</content>
</entry>
</feed>
