From: v.ondruch@... Date: 2016-05-30T10:43:27+00:00 Subject: [ruby-core:75770] [Ruby trunk Bug#12437] Is it "legal" to call collect! in class initializer? 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: