Project

General

Profile

Actions

Bug #6239

closed

super Does Not Pass Modified Rest Args When Originally Empty

Added by mudge (Paul Mucur) about 12 years ago. Updated about 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
1.8.7-p358
[ruby-core:44015]

Description

Given the following code:

class A
  def a(*args)
    args
  end
end

class B < A
  def a(*args)
    args << "foo"

    super
  end
end

1.8.7-p358> B.new.a("bar")
=> ["bar", "foo"]
1.8.7-p358> B.new.a
=> []

But:

1.9.2-p290> B.new.a("bar")
=> ["bar", "foo"]
1.9.2-p290> B.new.a
=> ["foo"]

The 1.9.2 behaviour is more predictable than 1.8.7, should this be backported or is this expected behaviour?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0