https://kotlinlang.org logo
t

tvede

06/06/2017, 6:18 PM
Hi guys, So can someone tell me why this gives a "overload resolution ambigurity" (example):
Copy code
typealias myFunctiontype = (String, Int) -> String
abstract class AbstractExample{
    abstract val baseFunction : myFunctiontype
}
class ImplExample : AbstractExample() {
    override val baseFunction
        get() = SomewhereElse::a

}
object SomewhereElse{
    fun a() : String{
        return ""
    }
    fun a(string: String) : String{
        return ""
    }

    fun a(string: String, int: Int) : String{
        return ""
    }
}
if i put the type after the "baseFunction" it works, but i fail to see why the compiler cannot choose the rigth "a", since it already has all the types in place ? Thanks 🙂