Files
kotlin-fork/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/missingComponentN.kt
T
Alejandro Serrano Mena b1551c67e0 KT-59504 [FIR] Check _ on destructuring declarations
Previously the checker was ignoring them, leading to missing diagnostics

^KT-59504 Fixed
2023-09-22 21:46:09 +00:00

16 lines
494 B
Kotlin
Vendored

class A {
operator fun component1() = 1
operator fun component2() = ""
}
fun test() {
val (_, _) = A()
val (_, _, _) = <!COMPONENT_FUNCTION_MISSING!>A()<!>
val (_: Int, _: String) = A()
val (_: String, _) = <!COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH!>A()<!>
val f: (A) -> Int = { (_, _) -> 1 }
val g: (A) -> Int = { (_, _, <!COMPONENT_FUNCTION_MISSING!>_<!>) -> 2 }
val h: (A) -> Int = { (<!COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH!>_: String<!>, _) -> 3}
}