Files
kotlin-fork/compiler/testData/codegen/box/callableReference/adaptedReferences/toStringNoReflect.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

28 lines
892 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_STDLIB
package test
import kotlin.test.assertEquals
class A {
fun foo(s: String = "", vararg xs: Long): CharSequence = "foo"
}
fun check(expected: String, x: Any) {
assertEquals(expected, x.toString())
}
fun coercionToUnit(f: (A, String, LongArray) -> Unit): Any = f
fun varargToElement(f: (A, String, Long, Long) -> CharSequence): Any = f
fun defaultAndVararg(f: (A) -> CharSequence): Any = f
fun allOfTheAbove(f: (A) -> Unit): Any = f
fun box(): String {
check("Function3<test.A, java.lang.String, long[], kotlin.Unit>", coercionToUnit(A::foo))
check("Function4<test.A, java.lang.String, java.lang.Long, java.lang.Long, java.lang.CharSequence>", varargToElement(A::foo))
check("Function1<test.A, java.lang.CharSequence>", defaultAndVararg(A::foo))
check("Function1<test.A, kotlin.Unit>", allOfTheAbove(A::foo))
return "OK"
}