Project

General

Profile

Actions

Bug #2050

closed

Abbreviated Assignment Operators No Longer Return rvalue

Added by runpaint (Run Paint Run Run) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-09-03 trunk 24741) [i686-linux]
Backport:
[ruby-core:25387]

Description

=begin
$ cat /tmp/h.rb
class H
def k end
def []=(k, v) [k, v] end
end

a = H.new
a[123] = 2
b = (a[123] += 2)
p b

$ ruby -v /tmp/h.rb
ruby 1.9.2dev (2009-09-03 trunk 24741) [i686-linux]
[123, 125]
$ ruby8 -v /tmp/h.rb
ruby 1.8.8dev (2009-09-04) [i686-linux]
125

http://redmine.ruby-lang.org/issues/show/1996 is presumably the same problem, but was reported against the Redmine project; opening a ticket here so it doesn't get overlooked.
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #1996: ||= &&= doesn't return rval, but result of methodClosed08/26/2009Actions
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 15 years ago

  • Status changed from Open to Closed

=begin
Applied in changeset r24761.
=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 15 years ago

  • Status changed from Closed to Open

=begin
$ ./ruby -v -
ruby 1.9.2dev (2009-09-18 trunk 24985) [i386-darwin9.8.0]
a=Hash.new{[]}
b=2,3
p a[:x]<<=[*b,1]
-:3:in []': wrong number of arguments(2 for 1) (ArgumentError) from -:3:in '

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 15 years ago

  • Status changed from Open to Closed

=begin
Applied in changeset r24999.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0