Files
kotlin-fork/compiler/testData/diagnostics/tests/ambiguityNamedVararg.kt
T
Nikolay Lunyak fe783d7121 [FIR] Require equivalent candidates to have the same parameters order
NB: In general, it's unclear what to do in cases
like the following one, even when sometimes
we could, indeed, prefer something:

```
fun foo(a: Int, b: String, c: Boolean)
fun foo(b: String, c: Boolean, a: Int)

foo(c = false, b = "", a = 0)
```

^KT-55933 Fixed
2023-07-10 09:43:22 +00:00

14 lines
449 B
Kotlin
Vendored

// FIR_IDENTICAL
// DIAGNOSTICS: -DEBUG_INFO_MISSING_UNRESOLVED
// ISSUE: KT-55933
fun swapVararg(vararg namedVararg: String, named: Int){}
fun swapVararg(named: Int, vararg namedVararg: String){}
val x = <!OVERLOAD_RESOLUTION_AMBIGUITY!>swapVararg<!>(named = 42, namedVararg = arrayOf("1", "2"),)
fun swap(string: String, int: Int){}
fun swap(int: Int, string: String){}
val y = <!OVERLOAD_RESOLUTION_AMBIGUITY!>swap<!>(int = 42, string = "2")