mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 15:51:01 +00:00
After vararg argument it's possible to pass values only by name, so here we modulate this behavior #KT-37721 Fixed
23 lines
365 B
Kotlin
Vendored
23 lines
365 B
Kotlin
Vendored
var result = "fail"
|
|
|
|
fun foo(vararg xs: Int, s1: String = "", s2: String = "OK") {
|
|
if (xs[0] == 42 && s1 == "good") {
|
|
result = s2
|
|
}
|
|
}
|
|
|
|
fun bar(vararg xs: Int, s: String = "") {}
|
|
|
|
fun use(fn: (IntArray, String) -> Unit) {
|
|
fn(intArrayOf(42), "good")
|
|
}
|
|
|
|
fun test() {
|
|
use(::foo)
|
|
use(::bar)
|
|
}
|
|
|
|
fun box(): String {
|
|
test()
|
|
return "OK"
|
|
} |