From: "ufuk (Ufuk Kayserilioglu)" Date: 2021-09-22T16:43:37+00:00 Subject: [ruby-core:105376] [Ruby master Bug#18185] BasicObject is inserted in the middle of the inheritance tree. Issue #18185 has been updated by ufuk (Ufuk Kayserilioglu). This looks like a duplicate of https://bugs.ruby-lang.org/issues/18182 to me. Granted, this has more info about what is going wrong in this situation, though. ---------------------------------------- Bug #18185: BasicObject is inserted in the middle of the inheritance tree. https://bugs.ruby-lang.org/issues/18185#change-93791 * Author: ksss (Yuki Kurihara) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.0dev (2021-09-22T10:04:55Z master 7c0230b05d) [arm64-darwin20] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- t.rb ``` ruby #! /usr/bin/env ruby class Mod < Module module InstanceMethods end def initialize(aaa:) include InstanceMethods end end class Foo def initialize(key:) end end class Bar < Foo include Mod.new(aaa: 1) end p Bar.ancestors p Bar.new(key: 1) ``` 3.0.2 ``` $ ruby -v t.rb ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20] [Bar, #, Mod::InstanceMethods, Foo, Object, Kernel, BasicObject] # ``` 3.1.0-dev ``` $ ruby -v t.rb ruby 3.1.0dev (2021-09-22T10:04:55Z master 7c0230b05d) [arm64-darwin20] [Bar, #, Mod::InstanceMethods, BasicObject, Foo, Object, Kernel, BasicObject] t.rb:20:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError) from t.rb:20:in `new' from t.rb:20:in `
' ``` I found this problem when running the Rails `db:schema:load`task. Upon closer inspection, the following code seemed to be causing the problem. https://github.com/rails/rails/blob/e44ce53f78fb376d8d48145e2319204a1a2ebfc9/activemodel/lib/active_model/type/date_time.rb#L8-L10 https://github.com/rails/rails/blob/e44ce53f78fb376d8d48145e2319204a1a2ebfc9/activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb t.rb is a small reproduction of this problem. This problem does not seem to occur in v3.0.2 of ruby. -- https://bugs.ruby-lang.org/ Unsubscribe: