[#92070] [Ruby trunk Feature#15667] Introduce malloc_trim(0) in full gc cycles — sam.saffron@...
Issue #15667 has been updated by sam.saffron (Sam Saffron).
3 messages
2019/04/01
[ruby-core:92282] [Ruby trunk Bug#15515] OpenStruct raising NoMethodError instead of ArgumentError
From:
ruby-core@...
Date:
2019-04-14 13:50:59 UTC
List:
ruby-core #92282
Issue #15515 has been updated by marcandre (Marc-Andre Lafortune). Status changed from Open to Closed Merged. Thank you for your contribution! ---------------------------------------- Bug #15515: OpenStruct raising NoMethodError instead of ArgumentError https://bugs.ruby-lang.org/issues/15515#change-77617 * Author: lugray (Lisa Ugray) * Status: Closed * Priority: Normal * Assignee: marcandre (Marc-Andre Lafortune) * Target version: * ruby -v: ruby 2.7.0dev (2019-01-07 trunk 66747) [x86_64-darwin18] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- When an `OpenStruct` has some attribute `foo`, calling the `foo` method with an argument gives a no method error: ```ruby foo = OpenStruct.new(bar: 'baz') foo.bar(0) # => NoMethodError (undefined method `bar' for #<OpenStruct bar="baz">) ``` This is confusing, since `foo.respond_to?(:bar) # => true`. I would expect: ```ruby foo = OpenStruct.new(bar: 'baz') foo.bar(0) # => ArgumentError (wrong number of arguments (given 1, expected 0)) ``` The included fixes this, and adjusts the arity `ArgumentError` for the setter to be in line with the default arity messaging too. ---Files-------------------------------- 0001-ostruct.rb-refine-arity-failure-message.patch (1.26 KB) 0001-ostruct.rb-refine-arity-failure-message.patch (1.96 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>