Project

General

Profile

Bug #15613

Enumerator::Chain#each doesn't relay block signature

Added by marcandre (Marc-Andre Lafortune) about 2 months ago. Updated about 2 months ago.

Status:
Open
Priority:
Normal
Target version:
-
[ruby-core:91600]

Description

Currently, the block given when iterating on the components of a Enumerator::Chain always have arity of -1 and lambda? is always false:

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.

Associated revisions

Revision b7f89968
Added by marcandre (Marc-Andre Lafortune) about 2 months ago

  • spec/ruby: Tweak Enuemrator::Chain#rewind spec so that arity of block matches what is yielded

Calling and_yield(*args) adds an implicit expectation that all the args are passed to a block that can accept them, even though blocks that are not lambda-like don't mind extra arguments.
It so happens that this spec passed on Ruby 2.6.1 See [Bug #15613]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 67095
Added by marcandre (Marc-Andre Lafortune) about 2 months ago

  • spec/ruby: Tweak Enuemrator::Chain#rewind spec so that arity of block matches what is yielded

Calling and_yield(*args) adds an implicit expectation that all the args are passed to a block that can accept them, even though blocks that are not lambda-like don't mind extra arguments.
It so happens that this spec passed on Ruby 2.6.1 See [Bug #15613]

History

#1

Updated by marcandre (Marc-Andre Lafortune) about 2 months ago

  • Status changed from Open to Closed

Applied in changeset trunk|r67095.


  • spec/ruby: Tweak Enuemrator::Chain#rewind spec so that arity of block matches what is yielded

Calling and_yield(*args) adds an implicit expectation that all the args are passed to a block that can accept them, even though blocks that are not lambda-like don't mind extra arguments.
It so happens that this spec passed on Ruby 2.6.1 See [Bug #15613]

#2

Updated by marcandre (Marc-Andre Lafortune) about 2 months ago

  • Status changed from Closed to Open

Also available in: Atom PDF