Files
kotlin/compiler/testData/codegen/box/reflection/call/simpleMemberFunction.kt
2019-11-19 11:00:09 +03:00

24 lines
445 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
class A {
fun foo(x: Int, y: Int) = x + y
}
fun box(): String {
val x = (A::foo).call(A(), 42, 239)
if (x != 281) return "Fail: $x"
try {
(A::foo).call()
return "Fail: no exception"
}
catch (e: Exception) {}
return "OK"
}