Project

General

Profile

Actions

Bug #11385

closed

`==` with bidirectional/cyclic dependency

Added by allenwq (Allen Wang) over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Assignee:
Target version:
-
[ruby-core:70076]

Description

class Something
  attr_accessor :friend
  def initialize(friend)
    self.friend = friend
  end

  def ==(other)
    friend == other.friend
  end
end


a = Something.new([])
b = Something.new([a])
a.friend = [b]

a == b

The above code returns true on OS X and Linux, by right it should give me a exception of stack level too deep.

( And on windows I can see the expected exception )


Files

test.rb (226 Bytes) test.rb Code to recreate the bug allenwq (Allen Wang), 07/22/2015 02:50 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #1448: [patch] Proper handling of recursive arraysClosed05/09/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0