Hi,

we had a discussion on #irc the minute before and I'm thinking that there
ought to be a warning in this situation:

class Foo
  BAR = "bar"

  def print_it
    p BAR
  end
end

class Bar < Foo
  def print_it
    p BAR
  end
end

Foo.new.print_it
Bar.new.print_it

class Bar < Foo
  # next line should IMHO issue a warning
  # because of the hidden constant Foo::BAR
  BAR = "foo"
end

Foo.new.print_it
Bar.new.print_it

Output:

"bar"
"bar"
"bar"
"foo"

This code does not warn (at least with 1.6.8) either with or without -w.

What do others think?

    robert