Project

General

Profile

Actions

Bug #6434

closed

Block passed implicitly via super

Added by trans (Thomas Sawyer) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
Backport:
[ruby-core:45036]

Description

=begin
Block is being passed via super implicitly even though the method is explicit and does not pass the block when calling super.

class H < Hash
  def initialize(default=nil, &block)
    super(default)
  end
end
H.new(0){}

ArgumentError: wrong number of arguments
from (pry):3:in `initialize'

Hash#initialize doesn't allow both a default argument and a default_proc, which is the cause of this error. Which means the block is being passed up even though it should not be.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0