Actions
Bug #17512
closedostruct super regression
Description
In ruby 3.0, Calling super on ostruct always returns nil. This is a regression in ruby 3.0 introduced when fixing another issue.
introduced by:
- https://bugs.ruby-lang.org/issues/12136
- https://github.com/ruby/ruby/commit/e026e186f4a01aa3f6cd02ae6ef33f44f129361c
This unintentionally changed super
behavior in classes that inherit from OpenStruct.
require 'ostruct'
class Foo < OpenStruct
def foo
super
end
end
p Foo.new(foo: 123).foo
Ruby 3.0:
=> nil
Ruby 2.7:
=> 123
Potential fix is to bring back some of the behavior reverted in issue #12136 to allow method missing to sometimes respond to methods with zero arguments.
This is implemented in: https://github.com/ruby/ruby/pull/4028 and included as a patch attached to this issue.
Files
Actions
Like0
Like0Like0