https://kotlinlang.org logo
#announcements
Title
# announcements
a

apatrida

01/04/2017, 2:54 PM
a weird typing thing I can’t figure out: This works fine:
Copy code
fun testBoth(s: String, arg: Array<out Any?>? = null, type:Array<KClass<out Any>>? = null) {}
                
 testBoth("", arrayOf(arrayOf("200")), arrayOf(Array<String>::class))
but when I overload this function:
Copy code
fun testBoth(s: String, arg: Array<out Any?>? = null, type:Array<KClass<out Any>>? = null) {}
fun testBoth(i: Int, arg: Array<out Any?>? = null, type:Array<KClass<out Any>>? = null) {}

testBoth("", arrayOf(arrayOf("200")), arrayOf(Array<String>::class))
error:
>> Error:(257, 17) Kotlin: None of the following functions can be called with the arguments supplied:
local final fun testBoth(i: Int, arg: Array<out Any?>? = ..., type: Array<KClass<out Any>>? = ...): Unit defined in uy.kohesive.keplin.common.TestResettableReplEngine.testOverridingArgsOnEachEval.<anonymous> local final fun testBoth(s: String, arg: Array<out Any?>? = ..., type: Array<KClass<out Any>>? = ...): Unit defined in uy.kohesive.keplin.common.TestResettableReplEngine.testOverridingArgsOnEachEval.<anonymous>