Project

General

Profile

Actions

Backport #1723

closed

respond_to? vs. to_ary

Added by zverok (Victor Shepelev) almost 15 years ago. Updated almost 13 years ago.

Status:
Closed
[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 [#<A:0xb5c9d0>, nil] is expected. If I comment out respond_to? in A, all works as expected
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0