Files
kotlin-fork/compiler/testData/codegen/box/callableReference/function/genericCallableReferenceArguments.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

34 lines
891 B
Kotlin
Vendored

// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// IGNORE_BACKEND: JS, NATIVE
// WITH_STDLIB
// WITH_REFLECT
import kotlin.test.assertEquals
fun <T, R> foo(x: T): R = TODO()
fun <T> fooReturnInt(x: T): Int = 1
inline fun <reified T, reified R> check(x: T, y: R, f: (T) -> R, tType: String, rType: String) {
assertEquals(tType, T::class.simpleName)
assertEquals(rType, R::class.simpleName)
}
inline fun <reified T, reified R> check(f: (T) -> R, g: (T) -> R, tType: String, rType: String) {
assertEquals(tType, T::class.simpleName)
assertEquals(rType, R::class.simpleName)
}
fun box(): String {
check("", 1, ::foo, "String", "Int")
check("", 1, ::fooReturnInt, "String", "Int")
check("", "", ::fooReturnInt, "String", "Any")
check(Int::toString, ::foo, "Int", "String")
return "OK"
}