04e57f712e
Relates to KT-8834, we continue reducing differences between old and new inference. Note that as for `SamConversionPerArgument`, this feature is enabled in the compiler and not in the IDE to avoid breaking code for those users that already enabled new inference in the compiler
48 lines
1.1 KiB
Kotlin
Vendored
48 lines
1.1 KiB
Kotlin
Vendored
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
|
|
// IGNORE_BACKEND: JS
|
|
// WITH_RUNTIME
|
|
|
|
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"
|
|
}
|