Scala's overloaded method resolution seems strange here:
abstract class Parent { type T }
class Child extends Parent { type T = Int }
def f[T <: Parent](a: Array[T]): Array[T#T] = null
def f[T](a: T): Array[T] = null
val s = f(Array(new Child)) // OK; calls the first f
val t: Array[Child#T] = f(Array(new Child)) // type mismatch; tries to apply the second f
Although s has the same type as t's, s is successfully evaluated using the first f but just giving a type hint makes the compiler try the second f and fail requiring Int as its argument. I ended up avoiding use of method overloading but just out of curiosity, can anybody inform me as to what's wrong here?