Project

General

Profile

Backport #1723

respond_to? vs. to_ary

Added by zverok (Victor Shepelev) almost 11 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:24139]

Description

=begin
# class with respond_to? redefined
class A
def respond_to?(m); false end
end

x = [A.new]

# deconstructing iteration
x.each do |a, b| p [a,b] end

It outputs [nil, nil], while [#, nil] is expected. If I comment out respond_to? in A, all works as expected
=end

Also available in: Atom PDF