Project

General

Profile

Actions

Feature #13574

open

Method redefinition warning

Added by tenderlovemaking (Aaron Patterson) over 7 years ago. Updated about 5 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:81230]

Description

Hi,

If I redefine a method like this, I get a warning:

class Foo
  def bar
  end
end

class Foo
  def bar
  end
end

If I alias the method to a different name, I don't get a warning:

class Foo
  def bar
  end
end

class Foo
  alias :foo :bar

  def bar
  end
end

I think this is expected. However, if I alias the method to itself, I don't get a warning:

class Foo
  def bar
  end
end

class Foo
  alias :bar :bar

  def bar
  end
end

I think this case should cause a warning.


Files

warn-on-same-name-alias.diff (425 Bytes) warn-on-same-name-alias.diff tenderlovemaking (Aaron Patterson), 05/19/2017 12:07 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0