Project

General

Profile

Actions

Bug #9353

closed

Struct setter methods now return the struct object rather than the value

Added by Anonymous over 10 years ago. Updated almost 10 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
[ruby-core:59509]

Description

~ ruby-2.1.0 λ irb

Struct.new(:foo).new.send(:foo=, 123)
=> #

~ ruby-2.0.0-p247 λ irb

Struct.new(:foo).new.send(:foo=, 123)
=> 123

This looks like a regression introduced by r41534, where rb_struct_set was changed:

  •        return ptr[i] = val;
    
  •        return RSTRUCT_SET(obj, i, val);
    

The RSTRUCT_SET macro was introduced in this commit, but it returns obj, not val.

I have attached a patch fixing this issue.


Files

rb_struct_set-regression.patch (437 Bytes) rb_struct_set-regression.patch Anonymous, 01/03/2014 06:31 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0