Project

General

Profile

Feature #13574

Method redefinition warning

Added by tenderlovemaking (Aaron Patterson) about 3 years ago. Updated 12 months ago.

Status:
Open
Priority:
Normal
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

Also available in: Atom PDF