Fix adaptation for references with default values after varargs
After vararg argument it's possible to pass values only by name, so here we modulate this behavior #KT-37721 Fixed
This commit is contained in:
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user