Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt
T
Tianyu Geng 761a0a7d0d FIR checkers: report specific errors instead of INAPPLICABLE_CANDIDATE
Specifically, the report the following 4 errors.

* NON_VARARG_SPREAD
* ARGUMENT_PASSED_TWICE
* TOO_MANY_ARGUMENTS
* NO_VALUE_FOR_PARAMETER

Also added/updated the following position strategies.
* NAME_OF_NAMED_ARGUMENT
* VALUE_ARGUMENTS
2021-04-02 14:36:14 +03:00

27 lines
627 B
Kotlin
Vendored

fun foo(first: Int, second: Double = 3.14, third: Boolean = false) {}
fun bar(first: Int, second: Double = 2.71, third: Boolean, fourth: String = "") {}
fun baz(x: Int, vararg y: String, z: Boolean = false) {}
fun test() {
foo(1)
foo(1, 2.0)
foo(1, 2.0, true)
foo(1, third = true)
foo(<!NO_VALUE_FOR_PARAMETER!>)<!>
foo(0, 0.0, false, <!TOO_MANY_ARGUMENTS!>""<!>)
bar(1, third = true)
bar(1, 2.0, true)
bar(1, 2.0, true, "my")
bar(1, true<!NO_VALUE_FOR_PARAMETER!>)<!>
baz(1)
baz(1, "my", "yours")
baz(1, z = true)
<!INAPPLICABLE_CANDIDATE!>baz<!>(0, "", false)
}