Issue #13922 has been reported by shevegen (Robert A. Heiler).

----------------------------------------
Feature #13922: Consider showing warning messages about same-named aliases - either directly or perhaps via the "did you mean gem"
https://bugs.ruby-lang.org/issues/13922

* Author: shevegen (Robert A. Heiler)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I file here rather than at https://github.com/yuki24/did_you_mean because I am not sure
if the site by Yuki Nishijima may be appropriate, so I think first ruby core has to 
decide on this.

Consider the following code:

    #!/usr/bin/ruby -w
    # =========================================================================== #
    class Foo
      def initialize
        unused_variable_warning = 42
        bar
      end
      def bar
        puts 'hello from bar'
      end; alias bar1 bar
           alias bar2 bar
           alias bar3 bar
           alias bar3 bar

    end

    Foo.new

The output will be something like:

    foo.rb:7: warning: assigned but unused variable - unused_variable_warning
    hello from bar

This is all fine. We get a warning, which is good.

My question is: should the same alias name also cause
a warning?

It is probably unimportant because it is an alias to the very same
method anyway, but I was just wondering in general.

In my opinion it may be better to actually also show a warning
similar to unused variables. But I can not say since perhaps 
people may prefer to not see any warning - I think that in most
cases, in the above, though, most people may have made a typo
or so. This is actually how I encountered this, I wanted to add
a new alias and noticed that I have had already two other, same
named aliases. It is no big deal but I was only wondering whether
the above behaviour to not show any warning was just an oversight
or whether it is deliberate.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>