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

47 lines
1021 B
Kotlin
Vendored

// WITH_STDLIB
import kotlin.test.assertEquals
class C(val expected: Int) {
fun memberVararg(i: Int, vararg s: String) {
assertEquals(expected, i)
assertEquals(0, s.size)
}
fun memberDefault(i: Int, s: String = "") {
assertEquals(expected, i)
assertEquals("", s)
}
fun memberBoth(i: Int, s: String = "", vararg t: String) {
assertEquals(expected, i)
assertEquals("", s)
assertEquals(0, t.size)
}
}
fun C.extensionVararg(i: Int, vararg s: String) {
memberVararg(i, *s)
}
fun C.extensionDefault(i: Int, s: String = "") {
memberDefault(i, s)
}
fun C.extensionBoth(i: Int, s: String = "", vararg t: String) {
memberBoth(i, s, *t)
}
fun test(f: (Int) -> Unit, p: Int) = f(p)
fun box(): String {
test(C(42)::memberVararg, 42)
test(C(42)::memberDefault, 42)
test(C(42)::memberBoth, 42)
test(C(42)::extensionVararg, 42)
test(C(42)::extensionDefault, 42)
test(C(42)::extensionBoth, 42)
return "OK"
}