-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Environment
Provide at least:
- master: 0aef1ec
- jruby-9.2.0.0
- jruby-9.2.1.0-dev
Expected Behavior
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>
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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels