JVM_IR: support vararg & defaults in function references
This commit is contained in:
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun foo(s: String = "kotlin", vararg t: String): Boolean {
|
||||
if (s != "kotlin") throw AssertionError(s)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun foo(vararg a: String, result: String = "OK"): String =
|
||||
if (a.size == 0) result else "Fail"
|
||||
|
||||
Vendored
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
fun foo(x: String, y: Char = 'K'): String = x + y
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun foo(x: String = "O", vararg y: String): String =
|
||||
if (y.size == 0) x + "K" else "Fail"
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
|
||||
class Outer(val o: String) {
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun foo(
|
||||
f: (
|
||||
Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
|
||||
Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
|
||||
Int, Int, Int, Int, Int, Int, Int, Int, Int, Int,
|
||||
Int, Int, Int, Int, Int, Int, Int, Int, Int, Int
|
||||
) -> String
|
||||
) = f(
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, 37, 38, 39, 40
|
||||
)
|
||||
|
||||
fun bar(first: Int, vararg args: Int) = if (args.size == 39) "OK" else "Fail: ${args.size}"
|
||||
|
||||
fun box(): String = foo(::bar)
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
fun foo(x: String, y: String = "K"): String = x + y
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun foo(x: String, vararg y: String): String =
|
||||
if (y.size == 0) x + "K" else "Fail"
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JS, JVM_IR
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun foo(x: Int, s: Int, vararg y: CharSequence = arrayOf("Aaa")): String =
|
||||
if (y.size == s && y[0].length == x) "OK" else "Fail"
|
||||
|
||||
Reference in New Issue
Block a user