Issue #15613 has been updated by jeremyevans0 (Jeremy Evans).

File enum-chain-lambda-15613.patch added

Attached is a patch that fixes this issue by switching from `rb_block_call` to `rb_funcall_with_block`.

----------------------------------------
Bug #15613: Enumerator::Chain#each doesn't relay block signature
https://bugs.ruby-lang.org/issues/15613#change-81232

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: 2.6.1
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently, the block given when iterating on the components of a `Enumerator::Chain` always have arity of -1 and `lambda?` is always `false`:

```ruby
class Foo
  include Enumerable
  def each(&block)
    return to_enum unless block
    p block.arity, block.lambda?
  end
end
foo = Foo.new

foo.each(&->{}) # => 0, true
foo.each.each(&->{}) # => 0, true
foo.chain.each(&->{}) # => -1, false. Would ideally be 0, true
```

It would be preferable if the block information wasn't lost.

---Files--------------------------------
enum-chain-lambda-15613.patch (2.02 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>