Add some tests on adapted references with varargs and reflection

Also rename "varargAndDefaults" test directory to "adaptedReferences"
This commit is contained in:
Alexander Udalov
2020-04-06 18:44:36 +02:00
parent 66995fe1a5
commit fa879e667f
27 changed files with 718 additions and 674 deletions
@@ -0,0 +1,15 @@
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(x: Int, s: Int, vararg y: CharSequence = arrayOf("Aaa")): String =
if (y.size == s && y[0].length == x) "OK" else "Fail"
fun use0(f: (Int, Int) -> String): String = f(3, 1)
fun use1(f: (Int, Int, String) -> String): String = f(5, 1, "Bbbbb")
fun use2(f: (Int, Int, String, String) -> String): String = f(5, 2, "Bbbbb", "Ccccc")
fun box(): String {
if (use0(::foo) != "OK") return "Fail0"
if (use1(::foo) != "OK") return "Fail1"
return use2(::foo)
}