Files
kotlin-fork/compiler/testData/diagnostics/tests/checkArguments/kt17691WithEnabledFeature.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

27 lines
665 B
Kotlin
Vendored

// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +UseCorrectExecutionOrderForVarargArguments
// WITH_STDLIB
fun foo(vararg x: Unit, y: Any) {}
fun main() {
foo({ }(), y = { }())
foo(x = *<!REDUNDANT_SPREAD_OPERATOR_IN_NAMED_FORM_IN_FUNCTION!>arrayOf({ }())<!>, y = { }())
foo(x = arrayOf({ }()), y = { }())
foo(*arrayOf({ }()), y = { }())
}
fun foo2(vararg x: Unit, y: Any, z: Any) {}
fun main2() {
foo2(y = { }(), x = arrayOf({ }()), z = { }())
}
fun foo3(vararg x: Unit, y: Any, z: Any = { }()) {}
fun main3() {
// no warning, execution order is already right
foo3(y = { }(), x = arrayOf({ }()))
}