When prepending a module which just calls super on the Struct, the first attribute gets initialized wrong:
klass = Struct.new(:runner_type, :output_type, keyword_init: true)
# correct output
puts klass.new({}) # -> #<struct runner_type=nil, output_type=nil>
klass.prepend(Module.new {
def initialize(**options)
puts options.inspect
super(options)
end
})
# wrong output -> runner_type is initialized to {}
puts klass.new({}) # -> #<struct runner_type={}, output_type=nil>
The output should be the same.
Environment
Provide at least:
Expected Behavior
When prepending a module which just calls super on the Struct, the first attribute gets initialized wrong:
Actual Behavior
The output should be the same.
The second call uses https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyStruct.java#L399 instead of https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyStruct.java#L354. Looking at the code, the same initializer should be used, no?