0681231e99
It's used as a superclass for anonymous classes for adapted function references. Its main feature is that it _doesn't_ inherit from KFunction (as opposed to FunctionReference), as per the decision to postpone reflection support for adapted function references in KT-36024. #KT-36024 Fixed
32 lines
806 B
Kotlin
Vendored
32 lines
806 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// WITH_REFLECT
|
|
|
|
import kotlin.reflect.*
|
|
import kotlin.test.assertNotEquals
|
|
|
|
class A {
|
|
fun foo(s: String = "", vararg xs: Long): String = "foo"
|
|
}
|
|
|
|
fun checkNotEqual(x: Any, y: Any) {
|
|
assertNotEquals(x, y)
|
|
assertNotEquals(y, x)
|
|
}
|
|
|
|
fun coercionToUnit(f: (A, String, LongArray) -> Unit): Any = f
|
|
fun varargToElement(f: (A, String, Long, Long) -> String): Any = f
|
|
fun defaultAndVararg(f: (A) -> String): Any = f
|
|
fun allOfTheAbove(f: (A) -> Unit): Any = f
|
|
|
|
fun box(): String {
|
|
val foo = A::class.members.single { it.name == "foo" }
|
|
|
|
checkNotEqual(coercionToUnit(A::foo), foo)
|
|
checkNotEqual(varargToElement(A::foo), foo)
|
|
checkNotEqual(defaultAndVararg(A::foo), foo)
|
|
checkNotEqual(allOfTheAbove(A::foo), foo)
|
|
|
|
return "OK"
|
|
}
|