Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/reflection/callBy/nonDefaultParameterOmitted.kt
T
Alexander Udalov 593937d302 Support KCallable.callBy with map of parameters to arguments
callBy is able to handle optional parameters.

 #KT-8827 Fixed
2015-08-29 18:37:40 +03:00

22 lines
461 B
Kotlin
Vendored

fun foo(x: Int, y: Int = 2) = x + y
fun box(): String {
try {
::foo.callBy(mapOf())
return "Fail: IllegalArgumentException must have been thrown"
}
catch (e: IllegalArgumentException) {
// OK
}
try {
::foo.callBy(mapOf(::foo.parameters.last() to 1))
return "Fail: IllegalArgumentException must have been thrown"
}
catch (e: IllegalArgumentException) {
// OK
}
return "OK"
}