Support default arguments and varargs for callable references

#KT-8834
 #KT-19869
 #KT-25514
This commit is contained in:
Alexander Udalov
2017-08-23 16:42:23 +03:00
parent f71909ee73
commit 9babd90999
17 changed files with 523 additions and 13 deletions
@@ -0,0 +1,28 @@
// !LANGUAGE: +NewInference
// IGNORE_BACKEND: JS, JS_IR, JVM_IR
// WITH_RUNTIME
import kotlin.test.assertEquals
object E : Exception()
fun foo(
a: String = "fail",
b: Int,
c: Double = 3.14,
vararg d: String,
e: Throwable = E
) {
assertEquals("ok", a)
assertEquals(42, b)
assertEquals(3.14, c)
assertEquals(0, d.size)
assertEquals(E, e)
}
fun bar(f: (String, Int) -> Unit) = f("ok", 42)
fun box(): String {
bar(::foo)
return "OK"
}