Files
kotlin-fork/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.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

17 lines
572 B
Kotlin
Vendored

// See KT-7813: Call to functional parameter with missing argument: no error detected but compiler crashes
fun foo(p: (Int, () -> Int) -> Unit) {
// Errors except last call
<!NO_VALUE_FOR_PARAMETER!>p { 1 }<!>
p(<!NO_VALUE_FOR_PARAMETER!>)<!> { 2 }
p(3) { 4 }
}
fun bar(p: (String, Any, () -> String) -> Unit) {
// Errors except last call
<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>p { "" }<!>
p(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!> { "x" }
p("y"<!NO_VALUE_FOR_PARAMETER!>)<!> { "z" }
p("v", Any()) { "w" }
}