Issue #12437 has been reported by Vit Ondruch.

----------------------------------------
Bug #12437: Is it "legal" to call collect! in class initializer?
https://bugs.ruby-lang.org/issues/12437

* Author: Vit Ondruch
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Is there any reason the following script should not work?

```ruby
#! /usr/bin/ruby

require 'set'

class Categories < Set

  def initialize(categories=[])
    categories.collect! { |category| category } if categories
    super categories
  end

end

categories = Categories.new()
categories += [1, 2, 3]
p categories

categories2 = Categories.new(categories)
p categories2
```

It fails with ```stack level too deep (SystemStackError)``` error and this regression seems to be introduced by r52591.

For details, please take a look at original issue reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1308057




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>