Proposal: make overload resolution bind more closely for matching types

As a side note, even reflective access to f fails:

  def main(args: Array[String]): Unit = {
//    (null: Demo0.ChildOverridesX).f(null: Y)
    (new ChildOverridesX: { def f(x: X): Unit }).f(null: Y)
  }

gives:

Exception in thread "main" java.lang.NoSuchMethodException: overloading.Demo0$ChildOverridesX.f(overloading.Demo0$X)

To resolve ambiguity error, you can upcast the receiver:

  def main(args: Array[String]): Unit = {
//    (null: Demo0.ChildOverridesX).f(null: Y)
    (new ChildOverridesX: Parent).f(null: Y)
  }

That helps in this case.